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!

Help with AWK script. 1

Status
Not open for further replies.

umcterp

Technical User
Jun 17, 2003
3
0
0
US
Given the following contents of a file how can I print all of it's contents and add a new line if the third fields name changes from the previous line?

Test a 400
Test a 400
Test b 500
Test b 500
Test c 502

Would like the output to look like the following.
Test a 400
Test a 400

Test b 500
Test b 500

Test c 502
 

Try this

{
if (hld3 != $3) {
if (NR>1) print ""
hld3 = $3
}
print
}

CaKiwi

"I love mankind, it's people I can't stand" - Linus Van Pelt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top