You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-12Lines changed: 11 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,47 +9,46 @@ On the Mac or Linux the easiest way to install `marcli` is via Homebrew:
9
9
10
10
```
11
11
brew install marcli
12
+
marcli -file yourfile.mrc
12
13
```
13
14
14
15
Or by downloading the binary for your OS from the [releases tab](https://github.com/hectorcorrea/marcli/releases) and marking the downloaded file as an executable:
Notice that if you install `marcli` via Homebrew the executable will be on your path and you can run it just by typing `marcli` from any folder, whereas if you install it via cURL you need to indicate the path `./marcli`.
27
24
28
25
## Sample of usage
29
26
30
-
Output MARC data to the console in a line delimited format:
27
+
Output MARC data to the console in a line delimited format (`marcli` automatically detects whether the file provided is in MARC XML or MARC binary):
28
+
31
29
```
32
30
./marcli -file data/test_1a.mrc
31
+
./marcli -file data/test_10.xml
33
32
```
34
33
35
-
If the file extension is `.xml` the file is expected to be a MARC XML file, otherwise MARC binary is assumed.
36
-
37
34
Extract MARC records on file that contain the string "wildlife"
38
35
```
39
36
./marcli -file data/test_10.mrc -match wildlife
40
37
```
41
38
42
-
Extracts MARC records on file that contain the string "wildlife" but outputs only fields "LDR,001,040,245a,650" for each record.
39
+
Extracts MARC records on file that contain the string "wildlife" but outputs only fields "LDR,001,040,245a,650" for each record, LDR means the leader of the MARC record. In the `-fields` parameter a letter (or letters) after the field tag indicates to output only those subfields. For example "907xz" means output subfield "x" and "z" in field "907".
The `-matchFields` parameter can be used to limit the fields where the match will be made:
49
46
50
-
A letter (or letters) after the field tag indicates to output only those subfields. For example "907xz" means output subfield "x" and "z" in field "907".
You can also use the `exclude` option to indicate fields to exclude from the output (notice that only full subfields are supported here, e.g. 970 is accepted but not 970a)
51
+
You can also use the `exclude` option to indicate fields to exclude from the output (notice that only full fields are supported here, e.g. 970 is accepted but not 970a)
53
52
54
53
You can also filter based on the presence of certain fields in the MARC record (regardless of their value), for example the following will only output records that have a MARC 110 field:
Copy file name to clipboardExpand all lines: cmd/marcli/main.go
+28-12Lines changed: 28 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,14 @@ import (
9
9
"github.com/hectorcorrea/marcli/pkg/marc"
10
10
)
11
11
12
-
varfileName, search, fields, exclude, format, hasFieldsstring
12
+
varfileName, search, searchFields, fields, exclude, format, hasFieldsstring
13
13
varstart, countint
14
14
vardebugbool
15
15
16
16
funcinit() {
17
17
flag.StringVar(&fileName, "file", "", "MARC file to process. Required.")
18
18
flag.StringVar(&search, "match", "", "String that must be present in the content of the record, case insensitive.")
19
+
flag.StringVar(&searchFields, "matchFields", "", "Comma delimited list of fields to search, used when match parameter is indicated, defaults to all fields.")
19
20
flag.StringVar(&fields, "fields", "", "Comma delimited list of fields to output.")
20
21
flag.StringVar(&exclude, "exclude", "", "Comma delimited list of fields to exclude from the output.")
0 commit comments