Am Fri, Jan 14, 2022 at 02:38:22PM +0000 schrieb russian sky:

> > I don’t quite follow. Do you mean the “.*”, so you replace .* with .?
> Yes. Based on the explanation of '*' in the gawk manual, it's
> used to match zero/one/more times repeating of the preceding character which 
> in turn doesn't match the default
> diff printing mode( >for removing, <for adding).

Why would it not match? . means “any character”.

> It's not necessary to add '*' to '/^>.*(=|Linux)/'.

I think it is.

“.*” basically means “any string of any length, including 0. “.” means
“exactly one character”.

So your original pattern will match '>somestuff=', '> a=', and even
'>Linux'. But without the *, it will only match if there is that one
character between > and = or Linux. Acutally, diff adds a space after the >,
so your expression will only match lines starting with '> =' or with '>
Linux'.

I’d actually replace gawk with sed, because the output of your gawk command
leaves the space in. If an example output for diff is:
6,7c6
< CONFIG_CC_IS_GCC=y
< CONFIG_GCC_VERSION=110100
---
> CONFIG_CC_IS_GCC=n

Then your line returns:
 CONFIG_CC_IS_GCC=n

If you use `sed -n 's/^> //p'` instead, the output will become:
CONFIG_CC_IS_GCC=n

-- 
Grüße | Greetings | Qapla’
Please do not share anything from, with or about me on any social network.

If I had a thousand tongues, you would all be to my taste.

Attachment: signature.asc
Description: PGP signature

Reply via email to