I'm using Bash and \\+ works with grep but not with sed.
For example if I do
echo "abbbbc"| sed -e s/ab\\+c/def/
I obtain this result : abbbbc
I tried with ' or with " around s/ab\\+c/def/, I obtain the same result.
but if I replace \\+ with *, I obtain : def
I have to change >Atab_TR4682|c0_g1_i1|m.14206 into Atab
If I do echo ">Atab_TR4682|c0_g1_i1|m.14206" | sed -e "s/>*\\([[:alpha:]]\\\*)_.\*/\1/g"
I obtain Atab_TR4682|c0_g1 probably because * could also be used for 0 iteration, but if I replace * by \\+ it doesn't work at all..
Does anyone have an explanation?
sed -rto use extended regular expressions perhaps? – DopeGhoti Mar 24 '17 at 17:34\before the+– don_crissti Mar 24 '17 at 17:35sedalready aliased tosed -r(orsed -E) maybe? That would turn\+into+and vice versa – steeldriver Mar 24 '17 at 17:46man sedand there was no-Eswitch, but there was-r, --regexp-extended. What I meant about the quotes, @don_crissti, is that if not in strong quotes,bashwill catch the escape before it'll even get tosed. – DopeGhoti Mar 24 '17 at 17:56') are what I was mentioning. – DopeGhoti Mar 24 '17 at 18:00sed --versionshow at your end ? – Mar 24 '17 at 18:03