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

SED

Name: Anonymous 2009-09-12 11:32

how would one substitute a / only in the (!) first column of each line?

Name: Anonymous 2009-09-12 11:42

wat?
in the (!) first column?
you mean something like this [code]s/^([^!]*)\//\1whatever/[code]?

Name: Anonymous 2009-09-12 11:42

s/^([^!]*)\//\1whatever/

Name: Anonymous 2009-09-12 11:49

>>2
lol/lol
lol/lol
/lol/lol
/lol/lol
output should be:
whateverlol/lol
whateverlol/lol
/lol/lol
/lol/lol

Name: Anonymous 2009-09-12 11:55

try this:
s/^([^\/])/whatever\1/;

Name: Anonymous 2009-09-12 11:59

>>5
>>3
getting a failure: \1 not defined in the RE

Name: Anonymous 2009-09-12 12:03

>>6
ah. i only tested it in perl.
you may need to use extended or perl compatible regexes if such an option exists.

Name: Anonymous 2009-09-12 12:05

>>7
got it:
sed -e 's:^\([^/]\):text\1:'

thank you anyway

Name: Anonymous 2009-09-12 15:51

>>7
That's the 'r' option. It will use posix regexes.

Name: Anonymous 2011-01-31 20:15

<-- check em dubz

Name: Anonymous 2011-02-04 15:28


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