sed regexp tips #1

Thanks to Jigen, this is another method to add and remove semicolon with sed. The result is the same as here.

To add semicolon:

sed -e ‘s/[01]/&;/g’ foo

To remove semicolon:

sed -e ‘s/\([01]\);/\1/g’ foo

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