Hi Experts, Have you tried doing a script for checking if there is a missing file based on the sequence number? Im tried doing it but I cannot achieve the correct output using AWK.
For Example:
Input:
FILE001
FILE002
FILE005
FILE006
FILE008
FILE009
FILE010
FILE014Output:
FILE003
FILE004
FILE007
FILE011
FILE012
FILE013
Does anybody tried doing this before? Any input is highly appreciated.Thank you in advance.
Regards,
Amiti
#!/bin/ksh awk ' BEGIN { lcnt=1 } { if(NR == 1) fbase=substr($1,1,(length($1) - 3) ) seqno=substr($1,(length($1) - 2) ) + 0 # the for loop prints any gap for(i=(lcnt+1); i<seqno; i++) printf("%s%03d\n", fbase, i) # save the previous sequence number lcnt=seqno } ' input > output
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |