March 3, 2009

Sed multiple substitution

Posted in Sed at 1:37 pm by alessiodini

It is possible apply a multiple substitution using sed with “-e” option

bash-2.05$ grep trovati 7-2-2008.log | awk ‘{print $9}’
[28]

If i want remove the bracket squares from the output i can use this option:

bash-2.05$ grep trovati 7-2-2008.log | awk ‘{print $9}’ | sed -e s/”\[“//g -e s/”\]”//g
28

It works!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: