1 |
On 2021-12-08, Adam Carter wrote: |
2 |
> |
3 |
> I want to replace any newlines between 'comment "' and the next '"' with |
4 |
> spaces so the whole comment is on a single line. How can it be done? |
5 |
|
6 |
|
7 |
Hmm, maybe: |
8 |
|
9 |
$ awk '/^comment "[^"]*$/ { ORS=" " } /"$/ { ORS="\n" } { print }' yourfile.txt |
10 |
|
11 |
That means if a line starts with 'comment "' but doesn't end with ", |
12 |
change the ORS (output record seperator) to a space. If it does end with |
13 |
a ", change it to a newline. |
14 |
|
15 |
Tavis. |
16 |
|
17 |
-- |
18 |
_o) $ lynx lock.cmpxchg8b.com |
19 |
/\\ _o) _o) $ finger taviso@×××.org |
20 |
_\_V _( ) _( ) @taviso |