I'm trying to edit fasta headers of multiple files, in order to remove a forward slash and everything after it (as long as 'everything after it' is equal or less than 10 characters). Header lines are marked by a '>'.
for i in ./*.fa;do sed -r 's/(>.*)\/.\{,10\}\n/\1\n/' "$i"; done
I've also tried
for i in ./*.fa;do sed -r 's/(>.*)\/.{,10}\n/\1\n/' "$i"; done
but it doesn't seem to be any better. My hunch is that it's the {,10} quantifier which breaks things. I'm not sure though. Help would be much appreciated!
For example, if the following was in a file:
>header1_some_extra_data_here/1-1000
ATGCGGGTACCCCA
>code/header2_some_extra_data
AGGTCCCCGGGAAAAA
I'd like the following to be the output:
>header1_some_extra_data_here
ATGCGGGTACCCCA
>code/header2_some_extra_data
AGGTCCCCGGGAAAAA
sedlike that (there are no newlines in the data that you see insed). If you show some example data, we would be able to say whether it would be enough to anchor the expression to the end with$, or if you have to do something else. Also, depending on thesedimplementation that you use, newlines may possibly not be inserted in the replacement part of thes///command.