Issue
I have a test1.txt
file with a lot of lines with different information. Among them, some lines have this kind of information:
Fam_grapsidae
Fam_bursidae
Fam_siluridae
I want to change the Fam_*
into italic{*}
, in order to have in test2.txt
:
italic{grapsidae}
italic{bursidae}
italic{siluridae}
So I tried with sed
:
sed 's/Fam_*/italic{*\}/g' test1.txt > test2.txt
But I obtained this:
italic{*}grapsidae
So, how can I integrate stars in the sed
command to have italic{grapsidae}
expression ?
Any advice is greatly appreciated.
Solution
What you want is:
sed 's/Fam_\(.*\)/italic{\1}/' test1.txt > test2.txt
Answered By - Jack