I am using a DEC ALPHA running Digital UNIX (formly DEC OSF/1) and ksh. I have a directory with hundreds of files that only share the extension .rpt. I would like to search that directory based on serial number and operation number and only files that meet both requirements to be printed out. I am new to scripting and have been try to do this with grep but have not had much luck.
here is a sample of the file: (120205462.rpt)
_________________________________
S/N: 10001 Name: ESSM GS Acceptance Operation: 300
-----------------------------------------------------
When I ran your code, it only listed the first file with 300 in it. Are you sure the number 300 doesn't occur anywhere else in the files that don't have an operation code of 300? The same with the serial numbers I suppose... if you're searching for files with a serial number of 10001, you could end up displaying files with a serial number of 3010 but which have 10001 somewhere else in the file...
I did this because there are chances of having 300 and 10001 in the collected data. using this and the egrep statement I get several operation 190's that have the serial number of 10001.