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 format strings to select command #810

Merged
merged 4 commits into from
Aug 29, 2024
Merged

Add format strings to select command #810

merged 4 commits into from
Aug 29, 2024

Conversation

nwagner84
Copy link
Member

@nwagner84 nwagner84 commented Aug 29, 2024

This PR adds the possibility of using PICA format strings in a select expression.

Examples

$ pica print aa.dat | grep '029A'
029A $a Deutschland $g Bundesrepublik $b Auswärtiges Amt $b Bibliothek

$ pica select '[email protected],029A{ a <$> (" (" g ")" <*> " / " [xb] <*> ", " n)}' aa.dat
004914848,Deutschland (Bundesrepublik) / Auswärtiges Amt / Bibliothek
$ pica select '[email protected],028[A@]{ [aP] <$> (", " d <*> " " c) | !U? || U == "Latn" }' goethe.dat
118540238,"Goethe, Johann Wolfgang"
118540238,"Goethe, Johan Wolfgang von"
118540238,"Goethe, Johan Wolphgang"
118540238,"Goethe, Johan W. von"
118540238,"Goethe, Joh. Wolfg. v."
...

Notes

  • Parsing of a Path expression takes precedence over a Format expressions. For example, 028A{ [ag] } is a valid Path and Format expression, but interpreted as Path. This expression can be turned into a Format expression by using a quantifier 028A{ [ag].. } or 028A{ [ag]..1 }.

@nwagner84 nwagner84 added C-enhancement Category: enhancement A-select Area: The select command labels Aug 29, 2024
@nwagner84 nwagner84 self-assigned this Aug 29, 2024
Signed-off-by: Nico Wagner <[email protected]>
Signed-off-by: Nico Wagner <[email protected]>
@nwagner84 nwagner84 merged commit 84f4ab6 into main Aug 29, 2024
32 checks passed
@nwagner84 nwagner84 deleted the select-format branch August 29, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-select Area: The select command C-enhancement Category: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant