How to use sed command on multiple files
1
0
Entering edit mode
3.5 years ago
utkarsh.sood ▴ 40

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 • 1.3k views
ADD COMMENT
0
Entering edit mode

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

bash: syntax error near unexpected token `;'

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode
3.5 years ago
lagartija ▴ 160

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

ADD COMMENT
0
Entering edit mode

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

bash: syntax error near unexpected token `;'

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2491 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6