• 0 Posts
  • 4 Comments
Joined 10 months ago
cake
Cake day: September 7th, 2023

help-circle

  • Lydia_K@startrek.websitetoLinux@lemmy.mlIs anyone using awk?
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    I use awk all the time, nothing too fancy, but when you need to pull out elements of text it’s usually way easier than using cut.

    awk {’ print $3 '} will pull the third element based on your IFS variable (internal field separater, default is whitespace)

    awk {’ print $NF ‘} gets you the last element, and awk {’ print $(NF-1) '} gets you one element from the last, and so on.

    Basic usage but so fast and easy for so many everyday command line things.