Hi
Input File A
L006 AL01 0 (OCK)
L006 A006 0 (OCK)
L011 AR11 1 (NLOCK)
Input File B
L006 AL01 0 (OCK)
L006 A006 0 (OCK)
Need Egrep Command for perfect Match
Thanks
Hi
Input File A
L006 AL01 0 (OCK)
L006 A006 0 (OCK)
L011 AR11 1 (NLOCK)
Input File B
L006 AL01 0 (OCK)
L006 A006 0 (OCK)
Need Egrep Command for perfect Match
Thanks
Perfect match? What are you matching? Do you mean FileA matches FileB if both files have the same contents?
Do you mean match lines in FileA and FileB? If so what constitutes a matching line? Do they match if the first field matches, first two fields match, first three fields, all fields match but spacing between fields can be different, the entire lines are identical, or something else?
Are the input files supposed to be sorted? (In your example they aren't.)
I have File A.txt
I want only egrep that line which have only OCK in file B.txt
I am tring below command but it not giving me proper output.
egrep -i '(OCK)' $fileA.txt> $fileB.txt
Thanks
I think we're having a language barrier problem. Your egrep command line is looking for any line containing any of the following strings in you input file: "ock", "Ock", "oCk", "OCk", "ocK", "OcK", "oCK", or "OCK". Is that what you want, or do you only want lines that contain the string "OCK", or lines that only contain the string "(OCK)"? What output is it giving you?
What is the output you get when you run the commands:
printf "fileA is \"%s\", fileB is \"%s\"\n" "$fileA" "$fileB"
ls -l $fileA.txt $fileB.txt
Does this work?
grep -i '(OCK)' $fileA.txt> $fileB.txt
Guessing that the OP doesn't realise the significance of parens in an ERE.