I have a file containing special color encoding characters:
$ cat zz
aaa.gpg
bbb.gpg
ccc.gpg
$ cat -A zz
^[[38;5;216maaa.gpg^[[00m$
^[[38;5;216mbbb.gpg^[[00m$
^[[38;5;216mccc.gpg^[[00m$
I need to use sed
command, to match the ending .gpg
and remove it. So, if there were no special characters, I would use:
cat zz | sed 's/\.gpg$//'
So how can I match the .gpg^[[00m$
pattern with sed
?
I tried all possible permutations, but still does not work. For example:
cat zz | sed 's/\.gpg\^\[\[00m$//'
sed
? – muru Dec 24 '20 at 06:07