Announcement

Collapse
No announcement yet.

neofetch and grep and Kubuntu 22.04.1

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    neofetch and grep and Kubuntu 22.04.1

    How to extract
    OS: Kubuntu 22.04.1 LTS x86_64
    from neofetch ?


    Code:
    neofetch --version    # Neofetch 7.1.0

    Code:
    grep --version     # grep (GNU grep) 3.7


    Code:
    neofetch |grep -ie 'cpu'   #works fine, giving:
    CPU: 12th Gen Intel i5-12500 (12) @ 5.900GHz

    But ...

    Code:
    neofetch |grep -ie 'OS:'   #fails
    Code:
    neofetch |grep -ie 'OS\:'  #fails Escaping meta-character : colon

    From neofetch, trying to get, extract, this one line:
    OS: Kubuntu 22.04.1 LTS x86_64
    How?











    neofetch
    `.:/ossyyyysso/:. x@xx
    .yyyyyyyyyyyyyyyyyyo:` -----
    -oyyyyyyyodMMyyyyyyyysyyyyo- OS: Kubuntu 22.04.1 LTS x86_64
    -syyyyyyyyyydMMyoyyyydmMMyyyyys- Host:
    oyyysdMysyyyydMMMMMMMMMMMMMyyyyyyyo Kernel: 5.15.0-52-generic
    `oyyyydMMMMysyysoooooodMMMMyyyyyyyyyo` Uptime: 34 mins
    oyyyyyydMMMMyyyyyyyyyyyysdMMysssssyyyo Packages: 2169 (dpkg), 7 (snap)
    -yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy- Shell: bash 5.1.16
    oyyyysoodMyyyyyyyyyyyyyyyyyyydMMMMysyyyo Resolution: 1920x1200
    yyysdMMMMMyyyyyyyyyyyyyyyyyyysosyyyyyyyy DE: Plasma 5.24.6
    yyysdMMMMMyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy WM: KWin
    oyyyyysosdyyyyyyyyyyyyyyyyyyydMMMMysyyyo Theme: [Plasma], Breeze [GTK2/3]
    -yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy- Icons: [Plasma], breeze-dark [GTK2/3]
    oyyyyyydMMMysyyyyyyyyyyysdMMyoyyyoyyyo Terminal: konsole
    `oyyyydMMMysyyyoooooodMMMMyoyyyyyyyyo CPU: 12th Gen Intel i5-12500 (12) @ 5.900GHz
    oyyysyyoyyyysdMMMMMMMMMMMyyyyyyyyo GPU: Intel Device 4690
    -syyyyyyyyydMMMysyyydMMMysyyyys- Memory: 1944MiB / 31799MiB
    -oyyyyyyydMMyyyyyyysosyyyyo-
    ./oyyyyyyyyyyyyyyyyyyo/.
    `.:/oosyyyysso/:.`


    --

    #2
    Strictly correct answer: don't.

    But if you really want to...

    neofetch is a tool to make system information pretty for people, and to that end uses colours, and the colon after "OS" is a different colour to the "OS" before it, so there's a terminal colour sequence before the colon so grep doesn't find "OS:". A simple solution is to use neofetch's stdout option:
    Code:
    $ neofetch --stdout | grep OS:
    ​OS: Kubuntu 22.04.1 LTS x86_64
    For most of that a script should be looking in /etc/os-release, but that says "Ubuntu" not "Kubuntu". See this post by claydoh if you really want to see the "K".
    Regards, John Little

    Comment

    Working...
    X