Let's say I have a text file like this:
group1 hello
group1 there
group1 nice line
group2 here
group2 we
group2 go
What I want to do is insert a line when the group of lines changes, something like:
group1 hello
group1 there
group1 nice line
---------------------------------------
group2 here
group2 we
group2 go
I don't care if that line also appears as the first and/or last line. At this time I only need something that separates the information.
How do I do that with sed or awk? Or maybe there are other ways?