Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find command list only the unique file name

Status
Not open for further replies.

DanGwo

Systems Engineer
Jul 11, 2019
1
CA
Hi...
I try to use the following command to search a string:
find . -type f -name "*.log" -mtime -2 |xargs grep '08:25:39'

The output is like:
...
./EngAppMgr_0008_8388884.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 Begin: construct BusComp "Account" at 5063ba48
./EngAppMgr_0008_8388884.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 Begin: construct BusComp "Account" at 57fa31f8
./EngAppMgr_0008_8388884.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 Begin: construct BusComp "Employee" at 30c8d398
./EngAppMgr_0008_8388884.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 Begin: construct BusComp "Employee" at 586f0cd8
./EngAppMgr_0008_8388884.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 Begin: construct BusComp "Responsibility" at 506f6ea8
./EngAppMgr_0008_8388884.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 Begin: construct BusComp "Responsibility" at 586f60d8
./EngAppMgr_0008_8388884.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 End: construct BusComp "Account" at 5063ba48
./EngAppMgr_0008_9989343.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 End: construct BusComp "Employee" at 5063ba48
./EngAppMgr_0008_9989343.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 End: construct BusComp "Response" at 5063ba48
./EngAppMgr_0008_9989343.log:ObjMgrBusCompLog Create 4 000011a8582900b2:0 2019-07-09 08:25:39 End: construct BusComp "Account" at 5063ba49

...

Is there a way to list only the unique file name? as I only interest if a file contains that string.

Regards,
Dangwo


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top