• Re: [gentoo-user] wiki page(kernel/upgrade) command confusion: 'cat' an

    From Frank Steinmetzger@21:1/5 to All on Fri Jan 14 13:20:02 2022
    Am Fri, Jan 14, 2022 at 10:05:54AM +0000 schrieb russian sky:
    the sentence is just as follows:

    diff <(cat .config | sort) <(cat .config.old | sort) | awk '/^>.*(=|Linux)/ { $1=""; print }'

    without inserting the 'cat' and '*'(the part of awk),It seems like, the result of the command is the same as before.


    Does the existence of the aboving 'cat'

    This, in my opinion, is a case of “useless use of cat”.
    `cat somefile | sort` can be replaced by “sort file”.

    and '*' (the part of awk)

    I don’t quite follow. Do you mean the “.*”, so you replace .* with .?

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

    Fat stains become like new if they are regularly treated with butter.

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEVbE9o2D2lE5fhoVsizG+tUDUMMoFAmHhai0ACgkQizG+tUDU MMqxMBAAtgl4o+jPo+hmHJxGvI/CLgGwYQlQz9B+XMrHjsOjKS+C/IY5gr9Iv7Jb QcEQubmZIGGkLIk/x1ISrkmKCeaQfe22ojxkkF4L+HKsE1V5M1pzPqTdqA7avh7k GiAuIuUMwwj8D173ugxy2MBKFDNeYflhpmcLnm52o4vR9HxDzFL5+TQCJsTcSHrD AhZtQJ4CXY8WzF2vlRXLw0qkOgsVpBepVjpms3K42oxzlwP679lRTcxKJUfjOq6W sEDmJp3s65WPmLqE+asnnsZ8U/QVBc/etkIk9utHYDZe1WExFvfvjhIl37qkWIag FgR+s64ACcwueAYgIW+Mb7rKAlfU1P8pc4CQrbCvDb2Vp0FUYOXBXbo5eHLMHjx3 N/XSBKKNKjHu6LoirJQNmkIVUlGhzszP4nrhrIkq6MRZkPDZ79K2ZDrFfTVTSwCt PTx0KSmeMyK//rENQrqZi9eWCQPgdU22nIb04XKl8Pa1coLCFYO0uGcDdPrvzVdL I2wXCcHjcjkIUsHKYIbZ8L1KxnM6A55QbPd64xXrINY9OVW0i3OS1kuZtscXRaho Nwa43BsmXxdlyVo11fytwBrdMRIsQ3NUnHU7Sp+0/76qdt6HVr6V6oVIOeN5PSlu RKlY0qUjFrUJyxuzpwDtIWX9Be3y4T3eZ1PUOasa2AEMifElGWg=
    =ciUp
    -----END PGP SIG
  • From Frank Steinmetzger@21:1/5 to All on Fri Jan 14 16:00:01 2022
    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.

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEVbE9o2D2lE5fhoVsizG+tUDUMMoFAmHhjwMACgkQizG+tUDU MMqOHBAAibfjIQBF6sgke9Y+kmguLeq2XPVFcZHkkEPD4q54uTTQ6yBTKPjf4Lo5 +Ll/gMt09F7G+WdKDKwOdDByKcrL8justA10Ine9Xc0XJU15oXMFg1q5xYhWhckr ROJs529+yFZPcldEoXj7YJwWXKD8TT04L82vDmDdlpJlA0wQkJgcJDiJQ/mOWbOM A6SppQ58GjK51byRQRhk5IorB+e6p5RhqqrUQcEGOZHz73ZOvq3BOMrHRIlBUXB6 FM9C2CznmrVwEavMtPFln0z8gHQ057yYlcMO31P0M+6yx75UG1vyupVnZJK+H6kz 0Pq+YUST2OEttlG0AnVd7pDA9hcBEm/qfbyNKvkeIZ4tMGrF8jpm0Ee6hkwituEJ wdXHvRSdXxgqBWV90ZvMAO4EGmIqfOv2VJRgK8xMrok8+IvgV3PmE8W0eX7aQGR0 zs3AvskK1sKWyPvqEnu8uDwbAQ42dvyO7lyhFsvSNTDojhjrczH6rU0eg83iL15/ 50Ep8GXCfK1GRsEW3IdEwIHNEfQlWngvpEEzUOMGe3lTRX1QMNiuSVJO
  • From russian sky@21:1/5 to All on Fri Jan 14 15:40:01 2022
    This, in my opinion, is a case of useless use of cat.
    `cat somefile | sort` can be replaced by sort file.
    Agree with that, i will attempt to add an replacing
    adivce to the talking page of the kernel/upgrade wiki
    page.

    I dont 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). It's not
    necessary to add '*' to '/^>.*(=|Linux)/'.

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"> <style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
    </head>
    <body dir="ltr">
    <div class="PlainText">&gt; This, in my opinion, is a case of useless use of cat.<br>
    &gt; `cat somefile | sort` can be replaced by sort file.<br>
    Agree with that, i will attempt to add an replacing</div>
    <div class="PlainText">adivce&nbsp; to the talking page of the kernel/upgrade wiki</div>
    <div class="PlainText">page.</div>
    <div class="PlainText"><br>
    </div>
    <div class="PlainText">&gt; I dont quite follow. Do you mean the .*, so you replace .* with .?<br>
    Yes. Based on the explanation of '*' in the gawk manual, it's</div>
    <div class="PlainText">used to match zero/one/more times repeating of the preceding character which in turn doesn't match the default</div>
    <div class="PlainText">diff printing mode( &gt;for removing, &lt;for adding). It's not <br>
    </div>
    <div class="PlainText">necessary to add '*' to '/^&gt;.*(=|Linux)/'.<br>
    </div>
    <div>
    <div class="BodyFragment"><font size="2"><span style="font-size:11pt;"></span></font></div>
    </div>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)