Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add subfield wildcard in path expressions #732

Merged
merged 1 commit into from
Dec 11, 2023
Merged

Conversation

nwagner84
Copy link
Member

@nwagner84 nwagner84 commented Dec 11, 2023

This PR introduce the subfield wildcard * in a path expression.

Example Record:

$ pica filter --keep '046G' '003@?' record.dat | pica print
046G $a Mitwirkung bei: Deutsches Schaffen und Ringen im Ausland $b ein Quellenlesebuch für [...] $f 1916
046G $a Hg. v. Leitfaden der deutschsprachigen Presse im Ausland $f 1984

The following commands lump all subfields of the field 045G together, which will be written to the second column:

$ pica select '[email protected], 045G.*' record.dat
00010244X,Mitwirkung bei: Deutsches Schaffen und Ringen im Ausland
00010244X,"ein Quellenlesebuch für Jugend und Volk, für Schule und Haus"
00010244X,1916
00010244X,Hg. v. Leitfaden der deutschsprachigen Presse im Ausland
00010244X,1984

This can be useful in combination with the --squash option to count the occurrences of a field:

$ pica select --squash '[email protected], 046G.*' record.dat
00010244X,"Mitwirkung bei: Deutsches Schaffen und Ringen im Ausland|ein Quellenlesebuch für [...]|1916"
00010244X,Hg. v. Leitfaden der deutschsprachigen Presse im Ausland|1984
$ pica select --squash '[email protected], 046G.*' record.dat | cut -d',' -f1
00010244X,
00010244X,

@nwagner84
Copy link
Member Author

CC: @mschumac

@nwagner84 nwagner84 added the C-enhancement Category: enhancement label Dec 11, 2023
@nwagner84 nwagner84 merged commit 2f9272d into main Dec 11, 2023
@nwagner84 nwagner84 deleted the path-subfield-wildcard branch December 11, 2023 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant