but sometimes there are newline characters in the comment field;
property "something"
comment "something
something else
a third thing"
I want to replace any newlines between 'comment "' and the next '"' with spaces so the whole comment is on a single line. How can it be done?
I want to replace any newlines between 'comment "' and the next '"' with spaces so the whole comment is on a single line. How can it be done?
Hmm, maybe:
$ awk '/^comment "[^"]*$/ { ORS=" " } /"$/ { ORS="\n" } { print }' yourfile.txt
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 47:52:11 |
Calls: | 6,648 |
Files: | 12,198 |
Messages: | 5,329,983 |