Input would be file name like following :
A-B-000001-C
A-B-000002-C
.....
.....
A-B-999999-C
All file should be sequential. I want to find missing sequential file names. For this I'm separating 6 digit sequence number using awk and using grep with regular expression to check if the file is present in the directory.
`ls|grep "A-B-${sequencenumber}-.*"|wc -l`
but shell script is not treating number as decimal and if I force the number to be treated as decimal using 10#$sequencenumber then its removing preceding zeroes which is necessary for searching the file.
Is there any way around this?
comm -13 <(ls) <(seq -f 'A-B-%06g-C' 999999)
to find the missing ones. See also Why is using a shell loop to process text considered bad practice? – Stéphane Chazelas Jan 10 '16 at 12:13