Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

sed and bourne shell scripting

Name: Anonymous 2008-03-09 7:46

i'm looking for a way to make sed NOT parse too much into the replace pattern

basically i'm trying to put a variable into the replace pattern, not a problem except that this variable contains stuff like -Wl and so forth, i suspect this makes sed bug out and throw errors like this
sed: 1: "s/^PERL_LDOPTS=/PERL_LD ...": bad flag in substitute command: 'u'
when i run code like this
MAKEFILE=`echo "$MAKEFILE" | sed s/^PERL_LDOPTS=/PERL_LDOPTS="$PERL_LDOPTS"/`
on text like this
PERL_LDOPTS=
and the content of the $PERL_LDOPTS variable is
  -Wl,-R/usr/local/lib/perl5/5.8.8/mach/CORE  -Wl,-E -L/usr/local/lib /usr/local/lib/perl5/5.8.8/mach/auto/DynaLoader/DynaLoader.a -L/usr/local/lib/perl5/5.8.8/mach/CORE -lperl -lm -lcrypt -lutil

so do i have to escape all the dashes or can i solve this with a sed argument?

Name: Anonymous 2008-03-09 7:57

nope doesn't even work when i escape the dashes and commas, wtf?

Name: Anonymous 2008-03-09 7:57

oh LOL i'm so stupid, i guess i should try escaping all those SLASHES!

Name: fusianasan 2008-03-09 8:12

nyoro~n

Name: Anonymous 2008-03-09 8:33

Dumbass

Name: Anonymous 2008-03-09 12:16

MAKEFILE=`echo "$MAKEFILE" | sed s|^PERL_LDOPTS=|PERL_LDOPTS="$PERL_LDOPTS"|`
Or use any other character which doesn't occur in $PERL_LDOPTS.

Name: Anonymous 2008-03-09 12:27

>>6
[s]MAKEFILE=`echo "$MAKEFILE" | sed s|^PERL_LDOPTS=|PERL_LDOPTS="$PERL_LDOPTS"|`[s]
MAKEFILE=`echo "$MAKEFILE" | sed 's|^PERL_LDOPTS=|PERL_LDOPTS='"$PERL_LDOPTS"'|`'
Forgot to escape the pipes.

Name: Anonymous 2008-03-09 13:07

>>7
I don't care.

Name: Anonymous 2008-03-09 13:59

i already solved this by escaping all the /'s

Name: Anonymous 2008-03-09 14:00

oh you can use other delimiters, i had no idea, that would save me a call to sed, thanks

Name: Anonymous 2008-03-09 14:34

>>10
No problem, I am glad I could provide a Turnkey Enterprise Solution for you.

Name: Anonymous 2009-03-06 7:04


basically because people want   when they try   to kill this   underground and they   both have a   command in C   The result may   vary between compilers   and architectures Also?

Name: Anonymous 2009-08-17 0:40

Lain.

Don't change these.
Name: Email:
Entire Thread Thread List