8

linux copy files with first row containing genome to other directory

view full story
linux-howto

http://stackoverflow.com – I have many files under the directory. And I want to copy those ones with first line contains "genome" word to a new folder. How should I do that. I can match those line out but I do not know how to manipulate the file again. I build a bash structure like for i in * do if [ sed -ne 'genome' $i ] then cp $i OTHERDIR fi done But it seems the if statement can do very limited thing and can not have sed in it unlike other programming language. (HowTos)