Home

Wednesday, December 24, 2008

Shell script to perl script

OK, this is how I normally do when there is is 2 types of script involved, the shell script to list out each file to be process by the perl script.

1. Let say you want to process files which contains name like "_Final"
2. Append the list of matched filename into a temporary file
3. Use a foreach looping to call the perl script to process each files in the list.
4. After the process is completed, you may want to add "rm -f file.txt" to removed the temporary file.

Sample of the script looks something like this.

#! /bin/csh

ls grep "_Final" > file.txt
echo "" > outname.csv

foreach file (`cat file.txt`)
./AMB_rev.pl $file
end

No comments:

Post a Comment