AWK - A Tool That Does Too Much

  Рет қаралды 11,559

The Exhausted Programmer

The Exhausted Programmer

Күн бұрын

Пікірлер: 72
@michaelhawthorne5516
@michaelhawthorne5516 Күн бұрын
Awk twah sed on that thang
@HelloThere-xs8ss
@HelloThere-xs8ss Күн бұрын
Slept on lol
@knnk4000
@knnk4000 17 сағат бұрын
ok thats it im ending it
@adityamwagh
@adityamwagh 13 сағат бұрын
lol
@DrKratso
@DrKratso 13 сағат бұрын
+2
@alerabbi
@alerabbi 12 сағат бұрын
You wget me?
@ericmintz8305
@ericmintz8305 8 сағат бұрын
Of all the languages I barely know and seldom use, AWK is by far and away my favorite. I seldom need it, but when need arises, nothing else will do, so I open the manual and code. Plus I know two of the three gentlemen of the old school who wrote the original, and they are beyond awesome.
@borkomne
@borkomne Сағат бұрын
Great video! I use awk a lot, and this what you presented here is what I use most of the time. There are 2 useful variables in awk I use often: NR - Number of current Record (useful to skip lines if there is a header in file) NF - Number of Fields in a current record (useful to figure out which lines are missing data)
@69k_gold
@69k_gold Күн бұрын
Awk 2? Ah what a good version
@ismbks
@ismbks 23 сағат бұрын
also known as C awk
@PotatoCider
@PotatoCider 23 сағат бұрын
awk tuah
@JoshuaLambamm-l4f
@JoshuaLambamm-l4f 5 сағат бұрын
C what you did there
@animanaut
@animanaut 7 сағат бұрын
imo one of the most overlooked feature of awk is the record separator. default is just newline, but some files have multiline entries or optional lines with additional information. It helped me once to parse log files that had regular log lines intermixed with lines of stacktraces.
@sanderdejong66
@sanderdejong66 21 сағат бұрын
I used to be an awk man, I never used sed. This vid brings back some memories 😊
@martins2246
@martins2246 Күн бұрын
"awk and sed"...those two always seem to be together. I made a relational db with csv's, awk and sed in an airgapped secuirty zone.
@paulsander5433
@paulsander5433 Күн бұрын
I hope you knew about the "join" and "sort" commands, too. A relational database would be hard to build without them.
@ismbks
@ismbks 23 сағат бұрын
perl is awk + sed + the gold standard regex implementation
@martins2246
@martins2246 13 сағат бұрын
@@paulsander5433 probably? it was in c shell lol...wtf
@paulsander5433
@paulsander5433 11 сағат бұрын
@@martins2246 The sort and join programs aren't shell built-ins, so they're available in csh, too. And they work well in pipelines.
@mxm650
@mxm650 6 сағат бұрын
Thanks for the quick overview! I wish this video had been out 10 days ago! I used to use awk a fair amount, but that was 15 or 20 years ago. I needed it last week, but I forgot all the syntax. It took a few hours of looking at man pages and searching to getting the basic syntax right. Worth it, though.
@milo3733
@milo3733 Күн бұрын
great introduction to awk, i always knew you could print columns but not much else. made me realize i've probably piped sed outputs into awk where I could have done it all in the awk command
@Soupie62
@Soupie62 6 сағат бұрын
Stock trading data includes: name, Open, High, Low, Close, and Volume. If you only care about Close, awkward will easily filter out unwanted data. If you only want particular shares, filter for lines starting with specific codes.
@SeanCCosgrove
@SeanCCosgrove 6 сағат бұрын
One of the features i find very powerful is that the field separator does not need to be a single character (put the default if any amount of whitespace), but can be a regex. Very handy even just for things where one column is separated by whitespace, but you also want to extract something delimited by ":" for example. I use awk too much, but only a small percentage of what it can do.
@chrismcgowan3938
@chrismcgowan3938 14 сағат бұрын
awk is one of my favourite languages. The language itself is very 'C' like, and I always found it easy to use, except for a few weird quirks. My main use of awk is to extract data out of huge amounts of text files, and on the command line for simple tasks. I think that awk is one of the most brilliant little tools that came out of the NIX word.
@zedzpan
@zedzpan Күн бұрын
Brings back many memories when I stumbled on awk.
@lel7531
@lel7531 7 сағат бұрын
Great video keep it up !!
@TheNovum
@TheNovum 21 сағат бұрын
Good video. this is what i like about *nix and *BSD
@GooogleGoglee
@GooogleGoglee 19 сағат бұрын
awk deserve a playlist just for itself.
@bitti1975
@bitti1975 Күн бұрын
I hope what people will gain from this is that awk can do much more than just printing columns. I can't count how often I see a `grep ... | awk ...` pipeline. Eh? Awk can select lines by regex... Unless you need a very specific grep feature there is no reason to do that.
@paulsander5433
@paulsander5433 Күн бұрын
Regretfully, awk doesn't seem to recognize extended regular expressions. That would be a legitimate use of grep before awk in a pipeline, but then it would probably be egrep rather than grep.
@dortechristiansen886
@dortechristiansen886 21 сағат бұрын
Speed could be the reason for many grep|awk
@bitti1975
@bitti1975 19 сағат бұрын
​@@dortechristiansen886 'Speed' regarding 'no time to think'? Clearly you can not mean performance, since invoking two programs (and another subshell) is of course slower than just one.
@bitti1975
@bitti1975 18 сағат бұрын
@@paulsander5433 I'm not sure what you mean. The original AWK (BSD/macOS) manpage says: "Regular expressions are as in egrep; see grep(1)." and GNU AWK's manpage says "Regular expressions are essentially the same as those in egrep(1).", so the most common AWK versions in use should support the same regexes as egrep.
@dortechristiansen886
@dortechristiansen886 14 сағат бұрын
If grep is many times faster to regex it could be faster
@ps-ri2qk
@ps-ri2qk Күн бұрын
Thanks for the Aho Weinberger Kernighan formatting/scripting tool video. I remember/forget this from the O'reilly books in the 90's. While trying to follow along on YT and pausing the video the lower area has this red line with controls, obfuscating the bottom 1/2" or so. Would you consider formatting it so the commands are well above the bottom area of the video? Then when it's paused it would be easily readable to look at in detail. Thanks again!
@kees3125
@kees3125 Күн бұрын
While paused, tap/click on empty area and controls are hidden!
@anon_y_mousse
@anon_y_mousse 23 сағат бұрын
I use awk in my .bashrc to filter various commands. For example, I print only the relevant drives from df's output and I make sure the header still prints out. Since I use a pattern for the type of drives to display, it even works with flash drives and external hard drives too.
@LitheInLitotes
@LitheInLitotes 20 сағат бұрын
Awk makes powershell's objects really desirable by comparison... Too bad ms is evil
@joeteejoetee
@joeteejoetee Күн бұрын
This very helpful for ole' rusty linux hobbiests like me. Liked and subscribed for sure. Thanks!
@AdrianBoyko
@AdrianBoyko Күн бұрын
I had a CompSci professor in the early 1990s who called AWK “The Queen of Programming Languages” 😵‍💫
@ohdude6643
@ohdude6643 Күн бұрын
He was not wrong.
@sarundayo
@sarundayo 8 сағат бұрын
What's the difference between AWK and GREP?
@Stephen-wc8fn
@Stephen-wc8fn 8 сағат бұрын
This brings to mind my biggest disappointment: Unix should have used tabs for column separation rather than spaces. A Unix tool chain built on tab and nl would have made text parsing so much easier.
@schlollepop
@schlollepop 21 сағат бұрын
Ah, the only write-only language ever invented. At some point, I gave up debugging awk scripts and just rewrote them from scratch if they did not work. The word “awkward” is derived from that language, right? 😉
@andreyv116
@andreyv116 Күн бұрын
Awk is quirky but it sucks less than doing non trivial things with sed
@EkShunya
@EkShunya 3 күн бұрын
why not talk abt perl as well
@TheExhaustedProgrammer
@TheExhaustedProgrammer 2 күн бұрын
I'll add it to the list
@trueriver1950
@trueriver1950 Күн бұрын
awk is well suited to short one-off scripting in a pipeline Anything more complicated then yes: I would use Perl.
@ivanheffner2587
@ivanheffner2587 Күн бұрын
I think this video showed up in my feed because earlier today I said: What do you get when you implement sed and awk in ksh? Perl 4. IIRC Larry Wall wrote Perl to combine multiple tools into one scripting language without so many pipelines. It made a pretty good programming language for a while, too.
@sssxxxttt
@sssxxxttt Күн бұрын
I skipped awk, except for being able to read it. If I can’t do it in sed I go to perl. Admittedly heavier but with hw of today…
@andreyv116
@andreyv116 Күн бұрын
Awk is more minimal than Perl but if your things are complex enough then Perl is more maintainable
@PaulHewsonPhD
@PaulHewsonPhD Күн бұрын
I still struggle to use awk where appropriate hoping one day I may get fluent. But one thing always beats me, csv files that have commas embedded within a quoted text field. Nice video!
@danblanks3190
@danblanks3190 Күн бұрын
It was commands like awk, clearly designed by committees of committees packed with a dizzying array of options, that make me so glad that I never have to work on a Linux system ever again for the rest of my life.
@anon_y_mousse
@anon_y_mousse 23 сағат бұрын
Point to where on the doll Linux touched you. Remember, therapy only works if you allow it to work.
@soppaism
@soppaism 23 сағат бұрын
I think it's the exact opposite of that. If you want to get as much done as possible while memorizing as little weird syntax as possible, awk is one of the best choices out there.
@stevevandevender8319
@stevevandevender8319 22 сағат бұрын
As pointed out in the video, awk was developed as part of the original UNIX in the 1970s when Linus Torvalds was still a toddler, and it's named after its original authors, Aho (co-author of a famous textbook "Principles of Compiler Design"), Weinberger, and Kernighan (who co-wrote "The C Programming Langugage" with Dennis Ritche and "The UNIX Programming Environment" with Rob Pike). So a committee of three, perhaps?
@danblanks3190
@danblanks3190 15 сағат бұрын
@@anon_y_mousse 😂😂😂
@PiotrRzeszów-c9x
@PiotrRzeszów-c9x Күн бұрын
maybe just use copilot + python?
@tracyrreed
@tracyrreed Күн бұрын
awk is a lot faster to whip up a one liner to do something like parse a process list vs opening a pipe from ps in Python and parsing that. Awk is everywhere and although python is pretty common these days you can't count on it being installed everywhere. Particularly inside busybox or a container. Plus, MS stinks. I don't want to put on those handcuffs.
@inertia_dagger
@inertia_dagger Күн бұрын
no
@wrathofainz
@wrathofainz Күн бұрын
Ew, Microsoft
@paulsander5433
@paulsander5433 Күн бұрын
@@tracyrreed The other problem with Python is that it's not source code compatible with Python. Every few minor releases, they change or remove a feature that breaks existing scripts. They didn't learn from Perl's early mistakes. Ruby has the same problem. Awk, sed, bash, ksh, and other languages generally don't have that problem.
@ivanheffner2587
@ivanheffner2587 21 сағат бұрын
@@PiotrRzeszów-c9x Or you could try being a decent programmer with an actual understanding of the tools you use rather than being next generation of skript kiddie reliant on GIGO LLM to do your job.
go is great i hate it
14:44
SST
Рет қаралды 21 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
We can now write scripts using these languages, but is it worth it?
8:28
How I make Windows look good
7:58
Coding with Sphere
Рет қаралды 195 М.
The Amazing Internet - 7Zip and VLC
9:36
The Exhausted Programmer
Рет қаралды 114
Python laid waste to my C++!
17:18
Sheafification of G
Рет қаралды 158 М.
Exploring Abandoned Games From Our Childhood
20:00
globert
Рет қаралды 97 М.
Python is 71x Slower, Uses 75x More Energy, Than C
23:29
Bryan Lunduke
Рет қаралды 41 М.
Catching up with async Rust
17:55
fasterthanlime
Рет қаралды 9 М.
Wubuntu - An Illegal Windows Like Distro
16:56
Mental Outlaw
Рет қаралды 434 М.
9 small, unproductive programs
7:43
The Exhausted Programmer
Рет қаралды 1,3 М.
Shot Down! Azerbaijan Airlines E-190 25 Dec 24
5:57
blancolirio
Рет қаралды 783 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН