Home    Search    Reference Manuals    Return   

Users Manual for Program FORALL_DO


Program FORALL_DO executes "sub_script" on multiple files.
Program FORALL_DO replaces the following UNIX-code:

for file in `ls *subst_1*`; do
 echo $file | awk '{print "sub_script " $0 " " gensub("subst_1", "subst_2", "g" , $0)}' | /bin/sh


 forall_do [options] sub_script  subst_1  [subst_2] 

Command line options

Following options are understood:

--ext = Only search for filenames ending with subst_1
--help = Write an information message
--test = Do not execute sub_script, only show what is going to be done
sub_script = Executable script or program which shall operate on all files selected by subst_1
subst_1 = Select the files in current directory having the expression subst_1 in their file names.
subst_2 = Expression which will replace subst_1 in the names of the created data files


Rename all files with extension .whe into .wheel:

 forall_do --ext mv .whe .wheel 

Translate all PostScript files into PDF-files:

 forall_do --ext gen_ps2pdf .ps .psd