Skip to content

Commit dbb6d19

Browse files
committed
docs: readme improvements
1 parent 5972161 commit dbb6d19

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

readme.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ pip install marcgrep # or use pip/pip3
1717

1818
```sh
1919
# general command format
20-
$ marcgrep OPTIONS FILE.mrc
21-
$ cat FILE.mrc | marcgrep OPTIONS
20+
marcgrep OPTIONS FILE.mrc
21+
cat FILE.mrc | marcgrep OPTIONS
2222
# full usage information
23-
$ marcgrep -h
23+
marcgrep -h
2424
Usage: marcgrep [OPTIONS] [FILE]
2525

2626
Find MARC records matching patterns in a file.
@@ -40,24 +40,26 @@ The `--include` and `--exclude` flags can be used multiple times to specify mult
4040

4141
```sh
4242
# records with a 780 field
43-
$ marcgrep -i 780 FILE.mrc
43+
marcgrep -i 780 FILE.mrc
4444
# records with Ulysses in the 245 field
45-
$ marcgrep -i '245,Ulysses' FILE.mrc
46-
# titles _without_ "Collected Poems" in the 245 $a subfield
47-
$ marcgrep -e '245,a,Collected Poems' FILE.mrc
45+
marcgrep -i '245,Ulysses' FILE.mrc
46+
# titles _without_ "Collected Poems" in the 245 a subfield
47+
marcgrep -e '245,a,Collected Poems' FILE.mrc
4848
# titles with second indicator = 4 that do not start with "The "
49-
$ marcgrep -i '245,,4,,^(?!The )' FILE.mrc
49+
marcgrep -i '245,,4,,^(?!The )' FILE.mrc
5050
```
5151

52-
The meaning of the pattern's components depends upon their number:
52+
The meaning of the filter expression's components depends upon their number:
5353

5454
- 1: field, `910` -> 910 is in record
5555
- 2: field and value (regular expression), `100,Lorde` -> 100 contains string "Lorde"
56-
- 3: field, subfield, and value, `506,a,Open Access` -> 506$a contains string "Open Access"
57-
- 4: field, subfield, first indicator, and value, `856,0,u,@lcsh\.gov` -> 856$u with 1st indicator 0 contains string "@lcsh.gov"
56+
- 3: field, subfield, and value, `506,a,Open Access` -> 506a contains string "Open Access"
57+
- 4: field, subfield, first indicator, and value, `856,0,u,@lcsh\.gov` -> 856u with 1st indicator 0 contains string "@lcsh.gov"
5858
- 5: field, subfield, first & second indicators, and value, `245,0,4,a,The Communist Manifesto`
5959

60-
The intention of this syntax is to facilitate searching subfields and field values more easily than MARCgrep.pl since we care about them more often than indicators. To ignore a component but use one of lesser priority, leave the component empty. For instance, `856,s,` refers to records with an `856` field with a `$s` subfield but the trailing comma means we don't care about the subfield's value. The pattern `245,,4,,` refers to records with a `245` field with a second indicator of `4` regardless its subfields or value.
60+
The intention of this syntax is to facilitate searching subfields and field values more easily than MARCgrep.pl since we care about them more often than indicators. To ignore a component but use one of lesser priority, leave the component empty. For instance, `856,s,` refers to records with an `856` field with an `s` subfield but the trailing comma means we don't care about the subfield's value. The pattern `245,,4,,` refers to records with a `245` field with a second indicator of `4` regardless its subfields or value.
61+
62+
To use a literal comma in a value pattern, include all the other components. For instance, to search for "Morrison, Toni" anywhere in a `100` field, use `100,,,,Morrison, Toni`.
6163

6264
Multiple criteria are combined with logical AND. Multiple `--include` flags is narrower than one, as is an `--include` and an `--exclude`.
6365

0 commit comments

Comments
 (0)