I have the following file "nbr_chk.txt" ,this file contains numbers that can be in any directory (from 1 to 10). the sub directory where they are is the 5th and 6th number
nbr_chk.txt
612345678
623456789
634567890
I want to make a script using that file and do the following:
for i in 'cat nbr_chk.txt'
do
ls -lrtd /*/d5d6/i to find the directory
if there is more than one directory print the directories
if there is only 1 directory use it and find if there is a file that contains the word " test" and print number xxxxxxxxx
done
edited 1:
For example the number 612345678 could be in the following directory /05/45/612345678 but could be also in the directory /09/45/612345678.
For that reason I need to do a ls -lrtd /*/.... to find the directory.
In case there are more than one directory I need to create an error message
d5 means the 5th digits and d6 the 6th digits of the number . if the number is 612300012 digit 5 =0 and digit 6=0 and the I would have to use ls -lrtd /*/00/612300012
If it was in an other language than Unix I would know how to do it but here I'm lost.
thanks