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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concat 2 greps

Status
Not open for further replies.

henky

Programmer
Jul 20, 2000
56
NL
Hi,

I would like to concat to greps to eachother.

p.e.

file: 016-00.txt
job started: thursday 15 july at 23:00:09

file: 017-01.txt
job started: friday 16 july at 23:00:08

output after the grep

016-thursday 15 july at 23:00:09
017-friday 16 july at 23:00:08

I was thinking about:
grep 'Job started: ' *txt | cut -c 1-4 (concat) grep 'Job started: ' *txt | cut -c 25-100

I dont know what to use in stead of the (concat)
Can anyone help me?
 
The awk way:
awk '
/[Jj]ob started:/{print substr(FILENAME,1,4)""substr($0,14)}
' *.txt

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top