Reputation: 879
let say i have a file such as
>Species_Name|KIOOL
AATATATATACACACAAGAGAGGA
>SPECIES_name|KUI
AATTAGAGAGA
>Species_names|POPPO
ATATGAATATA
How could I in bash get a new file such as :
>Species_Name
AATATATATACACACAAGAGAGGA
>SPECIES_name
AATTAGAGAGA
>Species_names
ATATGAATATA
I tried sed 's@|*@@'g my file
but it does not work
Thank you
Upvotes: 1
Views: 312
Reputation: 113994
|*
matches zero or more vertical bars. You appear to want to match one vertical bar followed by zero or more alphanumeric characters. Try:
$ sed 's/|[[:alnum:]]*//' file
>Species_Name
AATATATATACACACAAGAGAGGA
>SPECIES_name
AATTAGAGAGA
>Species_names
ATATGAATATA
In the revised question, it appears that you might want to remove everything after the first vertical bar. In that case, replace [[:alnum:]]
with .
since .
matches anything:
$ sed 's/|.*//' file
>Species_Name
AATATATATACACACAAGAGAGGA
>SPECIES_name
AATTAGAGAGA
>Species_names
ATATGAATATA
Upvotes: 3