I have the following file:
$ cat disk.out
disk0
fcs0
text
text
text
disk1
fcs1
text
text
text
text
...
What I am trying to achieve is match "disk" + "fcs" and then print the pair in one line, like this:
disk0,fcs0
disk1,fcs1
...
So I am matching "disk" and "fcs" with awk
and changing the output record separator to ",".`
$ awk '/disk|fcs/' ORS="," disk.out
disk0,fcs0,disk1,fcs1,
The problem is, it will print all the matches on one line and with a trailing ,
.
How can I print only per match in one line? Like this:
disk0,fcs0
disk1,fcs1
...