sed command catenation

Sometimes one sed command is not enough… (via Tobias)

Does anyone knows a way to do this more compact? My sed foo is very limited…

*sed "1,3d" %p | sed '/^$/d' | sed '$d' | base64 -d | gpg --decrypt |

%p is a filename in case you wonder.

The 1st * and the last | are needed elsewhere as well. I don’t really like the three seds

It should at least be possible to catenate the sed commands. Does one of these two syntaxes work with your sed version?

sed '1,3d;/^$/d;$d' %p | base64 -d | gpg --decrypt |

sed -e ‚1,3d‘ -e’/^$/d‘ -e ‚$d‘ %p | base64 -d | gpg –decrypt |

The best sed documentation IMO is the one from Grymoire. Here are the two methods mentioned above: The poorly documented ; and Multiple commands with -e command

Discussion Area - Leave a Comment