Básico SED

Imprime linhas com determinada string

sed -n '/word/p' file

Imprime linha seguinte ao encontrar string

sed -n '/word/{n;p;}' file

Apaga linhas com determinada string

sed '/word/d' file

Retirar espaços em branco repetidos

sed 's/[ ]\+/ /g' file

Substituir paralavra em arquivo

sed -i 's/word/new_word/' file

Adiciona caractere PIPE ao fim de cada linha

sed -i 's/$/|/' file

Fonte: http://thobias.org/doc/sosed.html

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