Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Im trying to check whether the contents of file_A is present in file_B. I thought about using grep command but that would be line by line. Im trying to compare a chunk of lines and see if this chunk is present in file_B.
An example of content in file_A:
"aaa bbbcccdddddd
dddd eee fff ggg
hh iiii jjj kkk"Any advice on how i can do this?
Pls help - thank you.

Im afraid not :( The guy is checking line by line which is something i know how to do.
But for my case here, i want to compare several combined lines and see if this combined lines is present in the other file.
e.g.
"I do not like to
go to school since young."I want to check if the sample sentence above (together with its 'new line') is present in the file being compared.
Maybe i need to make a script to first look for all lines with "I do not like to" and then check if the next line is "go to school since young". I dont want to do this because the lines involved are usually 10-20 lines...hence this method would be quite slow.
Any advice?

Please try this code: I use this to check archivelog directory with archivelog files.
counter=1
exec 3< ${tmpfile}while read -u3 line
do
grep "$line" ${tmpfile3} 1>/dev/null
if [[ $? -eq 1 ]]
then
print "Warning: File $line is missing from ***file!!!" >> $tmpfile4
fi(( counter += 1 ))
donesureshht

![]() |
Unix Installation error
|
ksh - var subs for input ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |