On Tue, 2 May 2006, Brendan Halpin wrote:
> I have a little sh/awk pair that does that for bibtex:
>> +-------------------------------------------------------------------
> |#! /bin/bash
> |gawk -f whole-bib.awk -v text="$1" $2
> +-------------------------------------------------------------------
> +-------------------------------------------------------------------
> |BEGIN {RS = "@"; status=1;}
> |
> |{if ($0 ~ text)
> | {
> | print RS $0;
> | status=0;
> | }
> |}
> |
> |END {exit status}
> +-------------------------------------------------------------------
You can just edit your whole-bib.awk file and add to the above
something like (untested, but you get the drift[1]):
#!/bin/env gawk -f
BEGIN {
text = "";
for (i = 1; i < ARGC; i++) {
if (ARGV[i] ~ /^(-t|--text)/)
if ((i + 1) < ARGC)
text = ARGV[i+1]
if (text == "")
exit 1;
}
then chmod a+x whole-bib.awk, and get rid of the shell script. Just
invoke whole-bib.awk directly:
$ ./whole-bib.awk --text whatever filename
1. See, e.g., http://hibernia.jakma.org/~paul/duplicate-files.awk
regards,
--
Paul Jakma paul at clubi.iepaul at jakma.org Key ID: 64A2FF6A
Fortune:
I WILL NOT CUT CORNERS
" " " " " "
" " " " " "
" " " " " "
Bart Simpson on chalkboard in episode 7F11
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!