Help - Search - Members - Calendar
Full Version: automation help request
Linuxhelp > Support > Programming in Linux
mkingiii
Is there a way to run a sequence of commands on a list/number of files without having to run them manually on each file. I want to unzip each file, perform a find and replace on each file, and then rezip each file. The command sequence I want to employ is:

gunzip file.gz ; perl -pi -e 's/YSN/LYS/g' file ; gzip file

Each file I want to do this to has a similiar name as follows:

./aa#/prod/#/#/final.pdb.gz (for example: ./aa1/prod/50/0/final.pdb.gz)

Thanks.
mkingiii
Ok, I know what I want to do can be done using a script file. However, I dont know how to write one. Can someone please help, this doesnt seem like that difficult a request for someone who knows what they are doing. Please help. I have 400000 files to run the commands on, so I really can not do this manually. I really need help to be able to apply the commands on a large scale.
markjr
QUOTE (mkingiii @ Oct 27 2006, 03:13 PM) *
Ok, I know what I want to do can be done using a script file. However, I dont know how to write one. Can someone please help, this doesnt seem like that difficult a request for someone who knows what they are doing. Please help. I have 400000 files to run the commands on, so I really can not do this manually. I really need help to be able to apply the commands on a large scale.


You can use things like the "for" loop in bash, or xargs (man xargs)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.