Skip to main content

Thread: Inversion and the addition of characters in the sed


i have characters:
code:
1  2  3  4  5
i want in sed:
code:
a  1  b  2  b  3  b  4  b  5
i have written:
code:
echo -e '1\n2\n3\n4\n5' | sed -n -e '1!g;h;$p' -e '1a a' -e '2,$a b'
i received:
code:
a  b  b  b  5  4  3  2  1  b
bad result. me somebody?

code:
echo -e '1\n2\n3\n4\n5' |  sed -e 's|^1$|a\n1|;s|^\([1-4]\)$|\1\nb|'
if line '1', append 'a' before
if line '[1-4]', append 'b' after


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Inversion and the addition of characters in the sed


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support