From: beatnick on
Hi, I'm trying to run bibexport.sh on a LaTeX aux file to produce a
subsetted .bib file. But when I run ./bibexport.sh it gets as far as
creating the new .bib file but doesn't write anything to it. Instead I
get the error:

sed: illegal option -- r
usage: sed script [-Ean] [-i extension] [file ...]
sed [-an] [-i extension] [-e script] ... [-f script_file] ...
[file ...]


Can anyone tell me what I'm doing wrong? I've read the user guide,
searched the web etc, am stumped.

Many thanks in advance,

Nick

From: Chris F.A. Johnson on
On 2006-10-29, beatnick wrote:
> Hi, I'm trying to run bibexport.sh on a LaTeX aux file to produce a
> subsetted .bib file. But when I run ./bibexport.sh it gets as far as
> creating the new .bib file but doesn't write anything to it. Instead I
> get the error:
>
> sed: illegal option -- r
> usage: sed script [-Ean] [-i extension] [file ...]
> sed [-an] [-i extension] [-e script] ... [-f script_file] ...
> [file ...]
>
>
> Can anyone tell me what I'm doing wrong? I've read the user guide,
> searched the web etc, am stumped.

You are not doing anything wrong; bibexport.sh is using a
non-standard (GNU only?) option to sed. The guide should have
mentioned that.

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
From: beatnick on

Chris F.A. Johnson wrote:

>
> You are not doing anything wrong; bibexport.sh is using a
> non-standard (GNU only?) option to sed. The guide should have
> mentioned that.
>
hmm, i see. So whats the easiest way to make this work? Bearing in mind
that my knowledge of Unix is minimal...

From: Chris F.A. Johnson on
On 2006-10-29, beatnick wrote:
>
> Chris F.A. Johnson wrote:
>
>>
>> You are not doing anything wrong; bibexport.sh is using a
>> non-standard (GNU only?) option to sed. The guide should have
>> mentioned that.
>>
> hmm, i see. So whats the easiest way to make this work? Bearing in mind
> that my knowledge of Unix is minimal...

Replace sed with egrep (or grep -E):

Change:

sed -r -e \
"/^ *[cC][rR][oO][sS][sS][rR][eE][fF] *= *[^,]+,?$/d" \
${TMPFILE}.bbl >> ${FINALFILE};


To (untested):

grep -E -v '^ *[cC][rR][oO][sS][sS][rR][eE][fF] *= *[^,]+,?$' \
${TMPFILE}.bbl >> ${FINALFILE};

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
From: Peter Flynn on
beatnick wrote:
> Hi, I'm trying to run bibexport.sh on a LaTeX aux file to produce a
> subsetted .bib file. But when I run ./bibexport.sh it gets as far as
> creating the new .bib file but doesn't write anything to it. Instead I
> get the error:
>
> sed: illegal option -- r
> usage: sed script [-Ean] [-i extension] [file ...]
> sed [-an] [-i extension] [-e script] ... [-f script_file] ...
> [file ...]
>
>
> Can anyone tell me what I'm doing wrong? I've read the user guide,
> searched the web etc, am stumped.

Isn't -r a GNU extension to sed or something? And you're using a
Sun or a Mac perhaps?

The offending line seems to be

sed -r -e \
"/^ *[cC][rR][oO][sS][sS][rR][eE][fF] *= *[^,]+,?$/d" \
${TMPFILE}.bbl >> ${FINALFILE};

I'm not enough of an RE hacker to know if that really requires -r
or not: try removing the -r and see if it works.

///Peter