Stupid sed Tricks

Here are some handy sed one-liners I’ve come across recently. Maybe someone else will find them handy.

Wrap each line with quotes (quotation marks) – version 1:

sed 's/^[^$]*$/"&"/'

Wrap each line with quotes (quotation marks) – version 2:

sed 's/.*/"&"/'

Replace space with escaped space:

sed 's/ /\\ /g'

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>