You're viewing a comment by pecival and its responses.

pecival Permalink
July 23, 2012, 19:03

you said
awk '{sub(/pattern/,"foobar")}1'
is the equivalent to
sed 's/pattern/foobar/'

..not exactly..AFAIK the sed part should have /g to apply the replace to all matches (not just the first one)..It's just a detail, but let's be precise ;)

(I hope I'm not saying nonsense)

Comment Responses

ohno Permalink
April 03, 2013, 11:08

AFAIK gsub() would be the equivalent to s///g. sub() only substitutes the first occurence.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.