User Tools

Site Tools


linux:sed

This is an old revision of the document!


sed

Replace the \n with values

Use test command

gsed ":a;N;s/\n/,/g;ta"

Or

gsed ":d;N;s/\n/,/g;td"

It means it will jump to the tag :a or :d, if one time failed, then it will break.

Use branch command

gsed ":a;N;s/\n/,/g;ba"

Or

gsed ":d;N;s/\n/,/g;bd"

delete the redundant empty lines

Refer

sed '/^$/{N;/^\n$/D}'
/var/www/dokuwiki/wiki/data/attic/linux/sed.1537955855.txt.gz · Last modified: 2018/09/26 17:57 by percy