I have a multi-column data file that I want to read in and do some task on each line.
FIELD1` is a file number
FIELD2 is a file name
FIELD3 is a date
For each record in the file, copy the file $FIELD1 from a directory into another directory but then append $FIELD2 to the filename. ie.
for record in myfile
do
spilt record into FIELD1,FIELD2,FIELD3
cp /tmpdir/$FIELD1 to /otherdir/$FIELD3.$FIELD2.$FIELD1
done
The problem is that the "for" loop treats each field as one line.
My data file is ;
12345 JOBNAME1 26/03/2001
24314 JOBNAMEX 26/04/2001
12345 JOBNAME4 27/03/2001
FIELD1` is a file number
FIELD2 is a file name
FIELD3 is a date
For each record in the file, copy the file $FIELD1 from a directory into another directory but then append $FIELD2 to the filename. ie.
for record in myfile
do
spilt record into FIELD1,FIELD2,FIELD3
cp /tmpdir/$FIELD1 to /otherdir/$FIELD3.$FIELD2.$FIELD1
done
The problem is that the "for" loop treats each field as one line.
My data file is ;
12345 JOBNAME1 26/03/2001
24314 JOBNAMEX 26/04/2001
12345 JOBNAME4 27/03/2001