Hello,
I have a comma delimited file such as:
cat /statistics/support/input.txt
ID,Serial,quantitity,atribute1,atribute2
1,89569698,5,800,9900,
1,35568658,8,1200,5550
1,89569698,8,320,5500
1,68753584,85,450,200
ID should always have 1 digit, Serial 8 digits, and the others may vary.
In a separate folder, for each entry in the above files I should have txt files such as:
ls /logs/
abc_89569698_2013_01_21.txt
bcd_35568658_2013_01_21.txt
cyz_89569698_2013_01_22.txt
ccc_68753584_2013_01_21.txt
zbv_21456774_2013_01_21.txt
If possible I would an awk script to compare the serials in
input.txt
against the file names in
/logs/
folder and to do the next ones:
- build a log in
/statistics/support/statistics.log
getting the number of match serials, and total number of files in
/logs
;
- if duplicates found then output in log:
89569698: 2013_01_21, 2013_01_22
;
- for all files which aren't in input.txt create a directory and subdirectory in
/logs/
called
/missing/21456774
and then move the file.
Thanks in advance for any help.