Linux Crash Course - awk

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ค. 2024
  • In this episode of Linux Crash Course, we take a look at the awk command. With awk, you can leverage its power for the "manipulation of data files, text retrieval and processing, and for prototyping and experimenting with algorithms". In this particular video, we'll cover the basics of awk to get you started.
    ☁️ Support LearnLinuxTV and Set up your own cloud server with Akamai Connected Cloud:
    ➡️ learnlinux.link/akamai
    LearnLinuxTV Sites
    🐧 Main site:
    ➡️ www.learnlinux.tv
    🐧 LearnLinuxTV Community:
    ➡️ community.learnlinux.tv
    Support LearnLinuxTV (commission earned)
    📖 Check out Jay's latest book, Mastering Ubuntu Server 4th Edition. Covers Ubuntu 22.04!
    ➡️ ubuntuserverbook.com
    🙌 Support me on Patreon and get early access to new content!
    ➡️ learnlinux.link/patron
    🛒 Affiliate store for Linux compatible hardware/accessories:
    ➡️ learnlinux.link/amazon
    💻 Check out the Tiny Pilot KVM for your Homelab:
    ➡️ learnlinux.link/tinypilot
    About Me
    🐦 Follow me on Twitter!
    ➡️ learnlinux.link/twitter
    👨 More about me:
    ➡️ www.jaylacroix.com
    ➡️ www.learnlinux.tv
    Recommended evergreen videos:
    💽 How to create a bootable flash drive for installing Linux
    ➡️ linux.video/flash-usb
    🐧 Understanding Linux permissions
    ➡️ linux.video/perms
    🐧 OpenSSH Guide
    ➡️ linux.video/ssh
    📖 LVM Deep-dive:
    ➡️ linux.video/lvm
    🔐 How to better secure OpenSSH:
    ➡️ linux.video/secure-ssh
    ☁️ How to create a cloud Linux server with Linode:
    ➡️ learnlinux.link/create-linode
    FAQ
    🐧 Which distro do I use?
    ➡️ learnlinux.link/mydistro
    💽 My recording gear (commissions earned):
    ➡️ learnlinux.link/recording-stuff
    #Linux #CLI #Awk
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 93

  • @meowcula
    @meowcula 2 ปีที่แล้ว +36

    what's even cooler is look into the history of awk - these foundational core applications have been a part of unix since the 70s. Awk in particular is from 1977.

    • @nodidog
      @nodidog ปีที่แล้ว +2

      I bet the commands took a bit longer to execute in 1977 than the milliseconds that they take today!

  • @scottspa74
    @scottspa74 11 หลายเดือนก่อน +6

    So much can be done with awk. An instructor of mine showed us an example where someone had written an entire graphic, first-person-shooter game, like DOOM, using just awk.

  • @SlideRSB
    @SlideRSB 2 ปีที่แล้ว +41

    So many channels I'm subscribed to have featured the Awk command, but only at a basic level. I would love to see a more advanced tutorial on Sed and Awk.

    • @SlideRSB
      @SlideRSB 2 ปีที่แล้ว

      @Unnat Shaneshwar no it isn't.

    • @LowOrbitFlux
      @LowOrbitFlux ปีที่แล้ว +2

      My AWK video is over 2 hours long.

    • @ramosman0469
      @ramosman0469 3 หลายเดือนก่อน

      Check out awk hack the planet

  • @thenargles
    @thenargles 2 ปีที่แล้ว +20

    I appreciated the "echoed this sentence echoed this sentence" :-)

  • @Yggdra666
    @Yggdra666 2 ปีที่แล้ว +10

    11:04 well that was.. awkward.
    Aight, I'll see myself out.

  • @bobwong8268
    @bobwong8268 2 ปีที่แล้ว +2

    👍👍👍👍👍THANK You, Jay!
    Great foundation for awk!
    Have been a topic that I wanted to learn; now I am more confident to explore.
    Execellent learning experience.
    Once again, thanks!

  • @BrucesWorldofStuff
    @BrucesWorldofStuff 2 ปีที่แล้ว +18

    Awk and Sed are both very useful, even together. I don't even pretend to know much about Awk but I find it fun just to see what output I can get sometimes... Lol Loved the ECHO Echo echo... Nice!
    I just used the '-F ' yesterday, so you brought a smile to my face, thanks... :-)
    Just love the Essentials series Jay.
    Thanks for the video!
    LLAP

  • @abhishekkumar1917
    @abhishekkumar1917 2 ปีที่แล้ว

    Thanks @jay
    I requested this video at official site. I am really happy to see that you have made videos on it really fast
    Really appreciate it ☺️

  • @yukinok25
    @yukinok25 3 หลายเดือนก่อน

    Excellent tutorial, super simple and easy to follow!

  • @Redwane-Music
    @Redwane-Music 2 ปีที่แล้ว

    great presentation and teaching. I like your sense of humour also, like in echo echo , very clever, but only few can notice that

  • @stephan6530
    @stephan6530 2 ปีที่แล้ว +7

    Nice intro tutorial. One small correction though: $0 represents the current record/row being processed, not the entire contents of the file.

  • @telmomarinho2729
    @telmomarinho2729 2 ปีที่แล้ว +8

    I'm a Linode customer, and he's totally right! I highly recommend!

  • @murtadha96
    @murtadha96 ปีที่แล้ว

    Brilliant explanation, thank you!

  • @Godmil
    @Godmil หลายเดือนก่อน

    8:40 I was sure he was going to choose the final field, totally laughed out loud at the actual result/comment 😄

  • @alexplane3279
    @alexplane3279 2 ปีที่แล้ว

    Thanks for this episode on awk , can we have a another one regarding using awk against logs like switch log , server logs ..to do troubleshooting

  • @TheEmperorXavier
    @TheEmperorXavier หลายเดือนก่อน

    That echo this sentence edit was really funny 😂, love it

  • @MarcoVinci
    @MarcoVinci 11 หลายเดือนก่อน

    Thank you very much for this lesson.

  • @mason8714
    @mason8714 ปีที่แล้ว

    great content as always

  • @abdelhamidbensadoun8077
    @abdelhamidbensadoun8077 2 ปีที่แล้ว

    Thank you so much Jay

  • @AnzanHoshinRoshi
    @AnzanHoshinRoshi 2 ปีที่แล้ว

    Thank you, Jay.

  • @mamadoumansour7564
    @mamadoumansour7564 2 ปีที่แล้ว

    Thanks!! awk is awmesome more videos with awk please

  • @CraftySmurf35
    @CraftySmurf35 ปีที่แล้ว

    Great explaination !

  • @zeppelinmexicano
    @zeppelinmexicano 3 หลายเดือนก่อน

    Awk seems like THE tool, the MUST HAVE tool.

  • @muntazirsaad1603
    @muntazirsaad1603 2 ปีที่แล้ว +2

    Keep going jay 💪 🙏

  • @mlarktar
    @mlarktar 2 ปีที่แล้ว +1

    For copy-pasting:
    leonardo blue leader
    raphael red hothead
    michelangelo orange party-animal
    donatello purple geek

  • @dragonsage6909
    @dragonsage6909 2 ปีที่แล้ว

    Great episode, ty

  • @kawan5851
    @kawan5851 23 วันที่ผ่านมา

    love your content.

  • @raughboy188
    @raughboy188 หลายเดือนก่อน

    Awk is incredily powerfull command capable of extending bash script's fuctionality far beyond what bash can normaly do by acting as interpreter. Basicly you can write code in programming language say python for example since python has it's roots in c and execute it in bash via wak because awk can interpret it in a way bash can execute it. Here in particular we have awk {print} where awk is executing print action from let's use python which you can't normaly use in bash instead you do same thing with cat. By using awk in your bash script as i said you can writr small program in c or similar lanugage and awk will as a said interpret it so bash can run it.

  • @cpubug
    @cpubug หลายเดือนก่อน

    thank you for the tutorial :)

  • @albertkenzie8249
    @albertkenzie8249 18 วันที่ผ่านมา

    very helpful thanks

  • @antonkovalev9681
    @antonkovalev9681 2 ปีที่แล้ว

    What is the theme of zsh/bash in terminal on preview pic?
    THNX!

  • @DaveSomething
    @DaveSomething 2 ปีที่แล้ว +8

    11:04 major glitch in the matrix! in the matrix... in the matrix.

  • @YannMetalhead
    @YannMetalhead หลายเดือนก่อน

    Good video!

  • @JeanFrancoCaringi
    @JeanFrancoCaringi 2 ปีที่แล้ว +1

    Gracias maestro

  • @ABDULKARIMHOMAIDI
    @ABDULKARIMHOMAIDI 6 หลายเดือนก่อน

    THANKS MAN !!!

  • @mondskiez309
    @mondskiez309 2 ปีที่แล้ว

    I see tmnt, I auto like.. another excellent video Jay.. turtle powah!

  • @tonyfreehauf4463
    @tonyfreehauf4463 ปีที่แล้ว

    Great Job -- please more more - oldtony

  • @pranavdesai-xv9qw
    @pranavdesai-xv9qw 5 หลายเดือนก่อน

    11.03 echo ...echo..echo haha. i noticed it thansks a lot for doing such efforts.

  • @fordprefect7779
    @fordprefect7779 2 ปีที่แล้ว +5

    11:05 echo causes also audio echo :-)

  • @sivaramakrishnachitithoti839
    @sivaramakrishnachitithoti839 10 หลายเดือนก่อน

    Thanks master

  • @GooogleGoglee
    @GooogleGoglee 2 ปีที่แล้ว

    Is there a way to select multiple values as a field separator for the "-F" parameter? (For example "spaces" AND ":")

    • @plangephace
      @plangephace 2 ปีที่แล้ว +1

      Yes. You can set the "-F" separator as an expression.
      >printf "this is plain:text" | awk -F'[ :]' '{print $1,$2,$3,$4}'
      >this is plain text
      >printf "this=is=plain:text" | awk -F'[=:]' '{print $1,$2,$3,$4}'
      >this is plain text
      -GNU AWK 4.1.4
      -Debian 10.10

  • @menthusajaya
    @menthusajaya 2 ปีที่แล้ว

    Thanks!

  • @tonyfreehauf4463
    @tonyfreehauf4463 ปีที่แล้ว

    we need more but good job ... oldtony

  • @asaskald
    @asaskald 2 ปีที่แล้ว +3

    Hey Jay, amazing work as always. You are my Master Splinter.
    I'm guessing that bracket expansion works here as well. I was curious if you thought a dedicated video about bracket expansion would be something that would interest you.
    Also... A video about Regex would be really neat. I think your approach to teaching works especially well for me and it would be pretty sweet. Also, I should probably check you channel to see if that video already exists.
    Thanks, Jay!

  • @_Verac
    @_Verac 2 หลายเดือนก่อน

    So I'm guessing awk is there to work with csv files. Right?

  • @robertmurphy9320
    @robertmurphy9320 2 ปีที่แล้ว

    Jay: Is that the new Darter Pro next to the Lenovo? Is there a review coming?

  • @NoEgg4u
    @NoEgg4u 2 ปีที่แล้ว +1

    How would you tell awk to print a range of fields?
    For example, if you wanted it to print fields $3 through $8?
    I understand that you can type out $3,$4,$5, etc. But if the range is large, that would be a lot of typing.
    I am assuming that this is easily done, once you know how to do it. But I cannot figure it out.
    Please advise.
    Thank you.

    • @NoEgg4u
      @NoEgg4u 2 ปีที่แล้ว

      @Terminalforlife (LL) Your explanation, although appreciated, is too complicated for me.

    • @thisvintagegirl
      @thisvintagegirl 9 หลายเดือนก่อน

      create a for loop and print each field:
      awk '{
      for (i = 3; i

  • @amortalbeing
    @amortalbeing 10 หลายเดือนก่อน

    thanks

  • @khomo12
    @khomo12 2 ปีที่แล้ว

    Cool!

  • @gaiusbaltar7122
    @gaiusbaltar7122 2 ปีที่แล้ว +3

    For simple tasks like that, you can use the cut command.

  • @srsr6099
    @srsr6099 2 ปีที่แล้ว

    Is bash coming up?

  • @rodrigomonteiro9086
    @rodrigomonteiro9086 2 ปีที่แล้ว

    Tmnt still popular!

  • @Lukiel666
    @Lukiel666 2 ปีที่แล้ว +2

    TMNT fan? Have you seen Usagi Yojimbo? Wandering Samurai rabbit.

  • @iincognito96
    @iincognito96 ปีที่แล้ว

    but how you get a single row

  • @johnmartintucker
    @johnmartintucker ปีที่แล้ว

    Not your best video....which really surprises me!

  • @citywitt3202
    @citywitt3202 2 ปีที่แล้ว

    Let’s hunt some AWK

  • @ErnestoPozzoni
    @ErnestoPozzoni 2 ปีที่แล้ว

    3:33 I actually came here only to hear about the Ninja Turtles :(

  • @yongzechen2139
    @yongzechen2139 10 หลายเดือนก่อน

    echo "are you ok!"|awk '{print $3}'

    • @yongzechen2139
      @yongzechen2139 10 หลายเดือนก่อน

      echo "are you ok\!"|awk '{print $3}'

  • @jonatalovrin6285
    @jonatalovrin6285 5 หลายเดือนก่อน +1

    Is it a programming language?

    • @bobert6686
      @bobert6686 หลายเดือนก่อน

      Yes

  • @johanferozco
    @johanferozco 2 ปีที่แล้ว

    I always thought Michelangelo was yellow and not orange.

  • @pepeshopping
    @pepeshopping 2 ปีที่แล้ว

    A YT ad right after your own?
    Nop!

  • @userhandle3378
    @userhandle3378 2 ปีที่แล้ว +1

    Doing gods work out here I see 🙏

  • @samitee8336
    @samitee8336 8 หลายเดือนก่อน +1

    'echo this sentence' 😅

  • @doge1931
    @doge1931 11 หลายเดือนก่อน

    what do u mean what is this awk all about i thought this was a ninja turtles video

  • @AriannaEuryaleMusic
    @AriannaEuryaleMusic 2 ปีที่แล้ว +1

    Thank You, You explained it much clearer and better than the other $ echo CHannels CHannels CHannels CHannels CHannels.

  • @immutablecantrip
    @immutablecantrip 2 ปีที่แล้ว

    ...it indexes at 1? my 0-based-indexing sensibilities are horrified.

  • @bluekeybo
    @bluekeybo 2 ปีที่แล้ว

    Jay, watch out man you're putting on quite a bit of weight :) Just watched an old video of yours and you were super skinny

  • @name1355_0ne
    @name1355_0ne 2 ปีที่แล้ว +1

    Nice joke about "echoing the sentence" ))

  • @RandomNullpointer
    @RandomNullpointer 2 ปีที่แล้ว +2

    Video starts 01:26
    I don't mean to hurt the channel, but seriously, There's a TH-cam ad before the video starts. then there's a 1+ min Linode ad before you say hi, then there's a floating TH-cam ad box over the video.
    Things like this scare away the followers, and make people prefer to use adblockers and other solutions...

    • @nevoyu
      @nevoyu 2 ปีที่แล้ว +6

      The problem is that advertisers like linode comes in and pays for a certain length of time and pays more than the youtube adsense ever will for a Linux channel

    • @juliobanda931
      @juliobanda931 2 ปีที่แล้ว +1

      Thanks for the skip button.
      You can try using the google chrome extension for an ad blocker. It gets rid of ads before and during the video, but it will not be able to do anything against the Linode add at the beginning of the video (obviously).

    • @Kekimus
      @Kekimus 2 ปีที่แล้ว +3

      @@juliobanda931 you can use sponsor block extension for that.

    • @drishalballaney6590
      @drishalballaney6590 2 ปีที่แล้ว +1

      there is also ublock origin tbh
      or you can play a video directly via mpv iirc

    • @AriannaEuryaleMusic
      @AriannaEuryaleMusic 2 ปีที่แล้ว +2

      I use Adblock plus and I haven´t seen any ad for years,
      but still, He is teaching for free, you should be thankful

  • @unbekannter_Nutzer
    @unbekannter_Nutzer 2 ปีที่แล้ว

    Too slow, too simple, for my taste.

  • @Euzahad
    @Euzahad ปีที่แล้ว +1

    too poor explanaition of this comand

  • @stephenbaum9150
    @stephenbaum9150 5 หลายเดือนก่อน +15

    Wow! So many minutes, so little information. 16 minutes of lifeless talk to demonstrate how to change a field separator and select columns. Three minutes would have been more than enough.