Skip to main content
2 of 2
added 63 characters in body; edited tags; edited title
Braiam
  • 36.9k
  • 29
  • 114
  • 176

Insert new line after non matching pattern

I have following output from script

host1:101 host1:102 host2:101 host2:102 host2:103 host4:101 host5:101 host5:102 host5:103 host5:104 

etc..

I wanted to insert a new line after each host group.

host1:101 host1:102 host2:101 host2:102 host3:101 host3:102 

Any AWK onliners to compare each consecute line with 1st field and insert new line before non-matching 1st field?

sudobash
  • 61
  • 1
  • 6