Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Finding matching patterns in two files

$
0
0
Hi,

I have requirement to find the matching patterns of two files in Unix. One file is the log file and the other is the error list file. If any pattern in the log file matches the list of errors in the error list file, then I would need to find the counts of the match.

For example,

Log file has the below information:

Code:

sftp> cd /home/development/project
sftp> MPUT ABCD_*.zip
Uploading ABCD_20150220_20150220012345.zip to /home/development/project/ABCD_20150220_20150220012345.zip
Couldn't get handle: Permission denied

error list file has the below information:

Code:

12,Permission denied,FTP error
14,No connection,Conection error

As "Permission denied" matches in both the files, the output count should be 1.

I tried to use grep -Ff option but I am getting the below error:

grep: illegal option -- F
grep: illegal option -- f
Usage: grep -hblcnsviw pattern file . . .

Please help

Viewing all articles
Browse latest Browse all 16232

Latest Images

Trending Articles



Latest Images