1855933 Members
11947 Online
104107 Solutions
New Discussion

Find out missing files

 
SOLVED
Go to solution
Fuad_1
Regular Advisor

Find out missing files

Hi,

I want to extract file name from log file, whenever there is no "#" character between two lines, the first line is starting with "Hash" and second line is the file name. Otherwise, if the hash is there that is transfered ok, and not required to get extracted. Portion of the log file is after this line:

-----------------------------------------------
Interactive mode off.
Hash mark printing on (1024 bytes/hash mark).
#
CDBHRBTALBVF00300
Tue Nov 4 08:01:55 WAT 2003
-----------------------------------------------
-----------------------------------------------
Interactive mode off.
Hash mark printing on (1024 bytes/hash mark).
CDBHRBTARETC02431
Tue Nov 4 08:31:40 WAT 2003
-----------------------------------------------
Set goals, and work to achieve them
3 REPLIES 3
TSaliba
Trusted Contributor

Re: Find out missing files

hi
try the following:

val=0
while read -r line
do
if [ $val -eq 1 ]
then
echo $line >> filena
val=0
continue
else
echo $line | grep Ha
if [ $? -eq 0 ]
then
val=1
else
val=0
fi
fi
done < text.txt
echo " filename "
cat filename


jj
TSaliba
Trusted Contributor
Solution

Re: Find out missing files

hi
you can use the attached script
jj
Fuad_1
Regular Advisor

Re: Find out missing files

Thank you friend, that is working.
Set goals, and work to achieve them