This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to use sed command on multiple files

Hi

I want to use the following command on multiple .faa files (around 1000 each starting with different name). Kindly help.

sed '/^>/ s/ .*//' 182965_iorA.faa > result/182965_iorA.faa

Best wishes

sed multiple files

Thank you for your quick response but I am getting the following error

bash: syntax error near unexpected token `;'

sorry : for i in *.faa ; do sed '/^>/ s/ .*//' $i > result/$i ; done

1 answer

if you want to treat all the .faa files of your directory you just do :

for i in *.faa ; do sed '/^>/ s/ .*//' $i > result/$i ; done

Thank you for your quick response but I am getting the following error

bash: syntax error near unexpected token `;'

There is an extra ; after do in the answer. Remove that.

Log in to answer this question.