Gentoo Archives: gentoo-user

From: Frank Steinmetzger <Warp_7@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] wiki page(kernel/upgrade) command confusion: 'cat' and 'awk'
Date: Fri, 14 Jan 2022 14:56:27
Message-Id: YeGPBTCyxgkNA5My@moby
In Reply to: Re: [gentoo-user] wiki page(kernel/upgrade) command confusion: 'cat' and 'awk' by russian sky
1 Am Fri, Jan 14, 2022 at 02:38:22PM +0000 schrieb russian sky:
2
3 > > I don’t quite follow. Do you mean the “.*”, so you replace .* with .?
4 > Yes. Based on the explanation of '*' in the gawk manual, it's
5 > used to match zero/one/more times repeating of the preceding character which in turn doesn't match the default
6 > diff printing mode( >for removing, <for adding).
7
8 Why would it not match? . means “any character”.
9
10 > It's not necessary to add '*' to '/^>.*(=|Linux)/'.
11
12 I think it is.
13
14 “.*” basically means “any string of any length, including 0. “.” means
15 “exactly one character”.
16
17 So your original pattern will match '>somestuff=', '> a=', and even
18 '>Linux'. But without the *, it will only match if there is that one
19 character between > and = or Linux. Acutally, diff adds a space after the >,
20 so your expression will only match lines starting with '> =' or with '>
21 Linux'.
22
23 I’d actually replace gawk with sed, because the output of your gawk command
24 leaves the space in. If an example output for diff is:
25 6,7c6
26 < CONFIG_CC_IS_GCC=y
27 < CONFIG_GCC_VERSION=110100
28 ---
29 > CONFIG_CC_IS_GCC=n
30
31 Then your line returns:
32 CONFIG_CC_IS_GCC=n
33
34 If you use `sed -n 's/^> //p'` instead, the output will become:
35 CONFIG_CC_IS_GCC=n
36
37 --
38 Grüße | Greetings | Qapla’
39 Please do not share anything from, with or about me on any social network.
40
41 If I had a thousand tongues, you would all be to my taste.

Attachments

File name MIME type
signature.asc application/pgp-signature