how to extract files one by one from a directory and let some processing be done on the file
I have a directory by name INTRN which has files like
INTR.0003080248636814
INTR.0003080248636816
INTR.0003080248636818
.
.
.
.
and so on
and in a script i have a nawk block
nawk '{
.
.
.
}' <filename>
my problem is how to how to extract files one by one from a directory and place it at the end of the nawk block,like get the file
INTR.0003080248636814 from the directory INTRN and put it at the end of the nawk block for processing,aftr processing get the second file and do the same for all the files in the directory.
please help me.thanks in advance.
that solution is nt working properly,every time it is refering to the same file
it is not refering to the next file,plz provide a solution.thnx in advance.
The following example reads through files finding files that match the input criteria, and then creates new filenames.
tailprg="/usr/local/bin/tail" #force version of tail command
echo "Shortening the filenames"
for rf in *_DAT; do
echo "Creating .dat for $rf"
tf=dm`basename $rf _DAT | $tailprg -c6`.dat
cp $rf $tf
done
You should be able to insert your code/commands inside the loop.