PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > sed: illegal option -- r when running bibexport.sh
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

sed: illegal option -- r when running bibexport.sh

Réponse
 
LinkBack Outils de la discussion
Vieux 29/10/2006, 22h45   #1
beatnick
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut sed: illegal option -- r when running bibexport.sh

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

  Réponse avec citation
Vieux 29/10/2006, 23h01   #2
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh

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
  Réponse avec citation
Vieux 29/10/2006, 23h09   #3
beatnick
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh


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...

  Réponse avec citation
Vieux 29/10/2006, 23h56   #4
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh

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
  Réponse avec citation
Vieux 30/10/2006, 01h05   #5
Peter Flynn
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh

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
  Réponse avec citation
Vieux 30/10/2006, 08h00   #6
Harald Hanche-Olsen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh

+ "Chris F.A. Johnson" <cfajohnson@gmail.com>:

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

which you ought to be able to simplify into

egrep -iv '^ *crossref *= *[^,]+,?$' \
${TMPFILE}.bbl >> ${FINALFILE};

AFAICT, the sed command that started the thread needed the GNU
specific -r option because sed regular expressions don't normally
support the special character `+'. But the grep ones do, hence no
need to use egrep. But doing so doesn't hurt, and it may be better to
leave it in just in case I'm wrong and some grep out there doesn't
support `+'.

--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
when there is no ground whatsoever for supposing it is true.
-- Bertrand Russell
  Réponse avec citation
Vieux 30/10/2006, 12h04   #7
Bruce Barnett
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

> AFAICT, the sed command that started the thread needed the GNU
> specific -r option because sed regular expressions don't normally
> support the special character `+'. But the grep ones do, hence no
> need to use egrep.


.....if your grep supports "+"

But if they are not using GNU sed, then what are the odds that grep
uses "+"?

--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.
  Réponse avec citation
Vieux 30/10/2006, 12h21   #8
Robin Fairbairns
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh

"Chris F.A. Johnson" <cfajohnson@gmail.com> writes:
>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};


this is one of nicolas markey's packages: nicolas, are you listening?
-- it would be good to update, i suspect.
--
Robin Fairbairns, Cambridge
  Réponse avec citation
Vieux 30/10/2006, 16h46   #9
beatnick
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh

Hi to all again - tried to post my thanks earlier but somehow it got
lost. Anyhow, I followed the egrep suggestion and the script ran
perfectly, so many thanks to you all.

And in answer to one of the earlier comments, yes, I'm running this on
a Mac...

regards,

Nick

  Réponse avec citation
Vieux 30/10/2006, 17h37   #10
Harald Hanche-Olsen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: illegal option -- r when running bibexport.sh

+ Bruce Barnett <spamhater113+U061030065017@grymoire.com>:

| Harald Hanche-Olsen <hanche@math.ntnu.no> writes:
|
|> AFAICT, the sed command that started the thread needed the GNU
|> specific -r option because sed regular expressions don't normally
|> support the special character `+'. But the grep ones do, hence no
|> need to use egrep.
|
| ....if your grep supports "+"
|
| But if they are not using GNU sed, then what are the odds that grep
| uses "+"?

Uh, thin. I was reading the man page for the SunOS grep too hastily;
it mentions +, but only in connection with the -E flag, which fact
eluded me. Mea culpa. Egrep it is, then. (But surely, using sed
where grep will do makes very little sense.)

--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
when there is no ground whatsoever for supposing it is true.
-- Bertrand Russell
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h02.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17174 seconds with 18 queries