Gentoo Archives: gentoo-user

From: Tavis Ormandy <taviso@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: script help - removing newlines
Date: Wed, 08 Dec 2021 22:10:16
Message-Id: sora5d$379$1@ciao.gmane.io
In Reply to: [gentoo-user] script help - removing newlines by Adam Carter
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

Replies

Subject Author
Re: [gentoo-user] Re: script help - removing newlines Adam Carter <adamcarter3@×××××.com>