Hi,
Here is an example of a problem I have:
File2: contain the following lines:
a^ aaa^aa aa^~
b^ bbb^bb bb^~
c^ ccc^cc cc^~
d^ dddd^dd dd^~
File1: contain the following lines:
b^ bbb^bb bb^~
c^ ccc^cc cc^~
I get File2 as input and I want to do as following:
for each line in file2 {
if (line exist in file1) print "! "line
>> output
else
print "+ "line >> output
}
I work on tcsh script:
and this is what I wrote:
cat File2 | awk -F"^" '{if (grep -c $0 file1 == 0) print "- "$0 >> output
else print "! "$0 >> output}'
Expected output:
- a^ aaa^aa aa^~
! b^ bbb^bb bb^~
! c^ ccc^cc cc^~ - d^ dddd^dd dd^~
But I get:
! a^ aaa^aa aa^~
! b^ bbb^bb bb^~
! c^ ccc^cc cc^~
! d^ dddd^dd dd^~
Any idea?
Thanks,
Bando.