For example,  we have the content001002004008010in a text file named file, how to extract the missing 3 5 6 7 9?
What is the most concise script to list the missing ones in a digit sequence?
bash;shell script;text processing
An awk way:$ awk 'NR != $1 { for (i = prev + 1; i < $1; i++) {print i} } { prev = $1 + 1 }' file35679More clearly:awk 'NR != $1 {  for (i = prev + 1; i < $1; i++) {    print i  }} {   prev = $1}'For each line, I check if the line number matches the number, and if not, prints every number between the previous number (prev) and the current number (exclusive, hence i = prev + 1).