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

put space after line 1

Status
Not open for further replies.

ng1

Technical User
Aug 22, 2007
39
0
0
US
I have a file something like this:

1234 $11 ABCD
1234 $5 XXXX
1299 $8 YYYY
1299 $6 FFCC
1299 $4 XCVB
1255 $1 XDCF
1255 $4 DDCC


output desired:

1234 $11 ABCD
1234 $5 XXXX

1299 $8 YYYY
1299 $6 FFCC
1299 $4 XCVB

1255 $1 XDCF
1255 $4 DDCC

I want a space inserted when string 1 changes. I have not done much with storing values so I don't know where to start. I would appreciate some help. Thanks!!
 
Hi

Code:
awk 'l[teal]&&[/teal]l[teal]!=[/teal][navy]$1[/navy][teal]{[/teal][b]printf[/b][green][i]"[/i][/green][lime][i]\n[/i][/lime][green][i]"[/i][/green][teal]}{[/teal][navy]l[/navy][teal]=[/teal][navy]$1[/navy][teal]}[/teal][purple]1[/purple]' /input/file
Tested with [tt]gawk[/tt] and [tt]mawk[/tt].

Feherke.
 
Awesome. Works great. Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top