EVERYONE Needs to Learn a Little Bit of AWK!

  Переглядів 393,403

Gary Explains

Gary Explains

День тому

AWK is a brilliant scripting language for processing text files, comma separated values, and text databases. Deal 60% off - Machine Learning & Data Science Bundle: andauth.co/MachineLearningBun...
If you find yourself creating spreadsheet to process rows of data or numbers then you MUST learn some AWK!
####
Machine Learning & Data Science Bundle - andauth.co/MachineLearningBun...
####
Introduction to Android app development: www.dgitacademy.com
Let Me Explain T-shirt: teespring.com/gary-explains-l...
Twitter: / garyexplains
Instagram: / garyexplains
#garyexplains

КОМЕНТАРІ: 1 100
@SEX_ON_DRUGS
@SEX_ON_DRUGS 4 роки тому
Gary I will never forgive you for teaching everyone my only impressive linux skill
@senantiasa
@senantiasa 4 роки тому
LOL, oh come one... the FOSS world is about sharing. But I completely understand what you're saying. It's also my only Linux skill that no one I know have the slightest understanding, yet they call me in for it...
@satibel
@satibel 3 роки тому
regex-plosion!
@mikicerise6250
@mikicerise6250 3 роки тому
Thanks, Gary. ;)
@ylc870
@ylc870 3 роки тому
Well those who really want learn this still have a bunch of documentation to read... No worries
@zonumev
@zonumev 2 роки тому
And he did it so effortlessly, made it look easy ... the mark of an expert! I'm happy to know that AWK ain't a dead skill 'cause I still rely on it.
@nickiebanchou
@nickiebanchou 4 роки тому
"forget spreadsheets and excel" crowd: ooh? "use command line!!" crowd : oh...
@1MinuteFlipDoc
@1MinuteFlipDoc 4 роки тому
yulp! LOL Python (heavy duty jobs) > Excel > AWK. AWK is a legacy tool. there's a reason people don't use it. hahahah
@tanithrosenbaum
@tanithrosenbaum 4 роки тому
@@1MinuteFlipDoc Except for those people who do use it. There's nothing legacy about it, it's just different from excel. And while that obviously doesn't include you (and that's fine), there are lots of people who prefer to write a short script on the command line over clicking through excel dialogs for 2 hours. For conditioning data to use it in data science and number crunching, awk gives you an amazing amount of productivity much quicker than excel does. If you still prefer excel that's fine though, your choice.
@andiriki
@andiriki 4 роки тому
nickie banchou thanks you save me Time.
@JohnR31415
@JohnR31415 4 роки тому
1MinuteFlipDoc awk is very powerful, use it pretty much every day. Can’t use excel in pipe chains...
@mrclaytron
@mrclaytron 4 роки тому
@@1MinuteFlipDoc no, people do use it all the time! Plus, it fits perfectly with the Unix philosophy of piping data from one small terminal program to the next. It's been around since the 1970s, but that certainly doesn't mean it's legacy - it's still an amazingly powerful tool that people still choose to use.
@captainz9
@captainz9 3 роки тому
Awk and grep were the heart of many scripts I've written over the years.
@carndt124
@carndt124 2 роки тому
Used AWK in 70's and 80's. Had an accounting system written in AWK. Also, had an AWK to C compiler, for the real hardcore number crunchers.
@andresmusetti
@andresmusetti 2 роки тому
Now that's a new level of awesomeness
@Prem-jd8li
@Prem-jd8li 2 роки тому
Very nice!
@mal-avcisi9783
@mal-avcisi9783 2 роки тому
i used AWK in 1941 in ww2 to decrypt enigma. was fun time
@michaelburns8073
@michaelburns8073 4 роки тому
If you like using Awk to do stuff like this, there are a few other cool Unix tools you should have a look at. Split, join, uniq will allow you to do DB-like things on text files. Another is tr. Of course sed, cut, grep as well. I took a grad course in which we had to create software development tools only using Unix tools. That class was both illuminating and fascinating. Learned a lot that I still use to this day.
@99corncob
@99corncob 2 роки тому
A lot of us learned to process tables of data using all these tools before spreadsheets were invented. Welcome to the club.
@CARPB147
@CARPB147 2 роки тому
Oh yes. Think of AWK as SQL for text files. You can SELECT rows, and columns (words separated by whatever delimiter applies), and even declare "WHERE" (conditions) using regular expressions and/or boolean operators. Your input could be log files, emails, or whatever you have on text (like text stuff on chats). It could be source code of any programming language if you are interested in gathering quality metrics on them. Your imagination is the limit.
@yashwanth.chaudhari339
@yashwanth.chaudhari339 9 місяців тому
CAN YOU share ur knowledge?
@egorsozonov7425
@egorsozonov7425 8 місяців тому
Yes, just like you said, "db-like". This is reinventing SQL with a bunch of half-assed incoherent unorthogonal tools barely cobbled together. It's simpler to just use a real DB like Sqlite.
@drwombat
@drwombat 6 місяців тому
As previously asked can you share your program you made? Or anything like it?
@meowcula
@meowcula 2 роки тому
awk is one of my favourite tools, not because I'm any good at using it, mind, but just because of its history. It's from 1977! The basic apps of our unix/linux ecosystem have a rich history.
@jimsteele9261
@jimsteele9261 2 роки тому
Back when I was contracting for EDS one of the sys admins handed me a book on AWK and asked me if I could figure out a way to extract billing info from the processing logs. I was hooked. :-) One of the handy features was using strings as array subscripts, and having "sparse" arrays, where only the accessed elements existed. Eventually, I had most of my production automated with AWK scripts.
@rondamon4408
@rondamon4408 4 роки тому
AWK? I thought I was the only dinosaur in this world which still uses AWK. Glad to know that I'm not the only one.
@wv1138
@wv1138 4 роки тому
That guy (or gal) that they don't let out much whips out awk like an old trucker whipping out a snatch block
@JohnDavidDunlap
@JohnDavidDunlap 4 роки тому
Use it every day.
@soiledhalo2296
@soiledhalo2296 4 роки тому
It's been a while since I've used it. First time I ever had to use it was in the early 2000s at a call centre. Their call detail records were gigabyte size and excel was struggling with it. AWK just crunched through the numbers and spit out the results in less than 5 minutes. Think I used SED initially, but AWK was the answer.
@johnnyq4260
@johnnyq4260 3 роки тому
Now if you two will mate, the dinosaurs will not go extinct.
@johnmcginnis5201
@johnmcginnis5201 3 роки тому
I can have a log file parsed with awk faster than that young'n with a spreadsheet. And reformatting an address file that has quotes drives excel nuts. In awk you just manipulate the FS constant. I might be a dinosaur but I would point out that the dinosaur ruled the earth for 165m years and birds are still here.
@zeke6099
@zeke6099 4 роки тому
I've tried reading more than one awk intro and I've never made it very far. You've successfully taught me way more than all of them, thank you!
@GaryExplains
@GaryExplains 4 роки тому
Glad I could help!
@prettylitch1785
@prettylitch1785 2 роки тому
00:00 Intro 01:15 more show data in file 01:29 wc -l show number of lines in data 01:48 awk '{print}' prints file 02:24 awk '{print $0}' $0 prints every line, $1 prints first field ect. 03:10 awk '/gcc/ {print $1}' match gcc print file name 03:41 awk '/^w/ {print $1}' Lines start with a double-u 04:23 awk '/path/ {print $1,$2}' Lines start with path, include multiple lines 04:41 awk '/path/ {print $1,$2/1024}' can divide output
@RoryIsNotACabbage
@RoryIsNotACabbage 2 роки тому
Man I've watched so many awk videos and this has been the only one that has said "this is why you do it" rather than just do the thing I don't know how people expect you to learn when they don't explain what you're doing
@nickskywalker2568
@nickskywalker2568 3 роки тому
Best introduction I've ever seen! I've always been kind of reluctant to learn, but knowing inside that I should do it... Thanks for the video!
@aravindhreturns
@aravindhreturns 3 роки тому
WHOA! As the class went on, My eyes only widened. Thank you Gary! Much love
@IreshDissanayakaM
@IreshDissanayakaM 3 роки тому
This is the best introduction to awk I have encountered.
@srirachahero4679
@srirachahero4679 2 роки тому
It's 2:00AM and I'm watching Gary Explain awk... and it was amazing! Thank you, Mr. Simms!
@erectlocution
@erectlocution 3 роки тому
I really appreciate how you build up here. I've done most of this in my tinkering but this adds some context that's really helpful.
@AuctorisVideo
@AuctorisVideo 4 роки тому
Nice video Gary. In case you (or anyone else watching) didn't know - you can simplify your "rounding up the file sizes" example using printf() and a format specifier. For example to print the file sizes to one decimal place you could use: {printf("%s %.1fKb ",$1, $2/1024)} Or: {printf("%s %.0fKb ",$1, $2/1024)} To recreate your exmaple & round to the nearest integer…
@ripwolfe
@ripwolfe 3 роки тому
I used awk to do data analysis of a large database that output data as a .csv. The company hired an "analyst" (really, he just ran DB scripts) to put the data into Excel, format it and run a few math functions on it. It took 3 hours to complete their way. The awk way took less than 15 minutes.
@lacs83
@lacs83 3 роки тому
Una historia de exito en el uso de AWK
@CARPB147
@CARPB147 2 роки тому
Excel is good at many things, but doing what that analyst did was shstoopid... "A hammer thinks that every problem is a nail."
@d3vilscry666
@d3vilscry666 Місяць тому
Was it accurate tho?
@juzujuzu4555
@juzujuzu4555 4 роки тому
Gary, I love these introductions to Linux/unix commands/software.
@scottkelbell5003
@scottkelbell5003 4 роки тому
Easy to learn, too. I love awk! Thank you Gary!
@aseerose5684
@aseerose5684 4 роки тому
I have used it to generate a useful database of user information from emails after concatenating the emails for processing. It was not hard to learn and ended up being a very useful multi-purpose tool in addition to its primary mission success. Thanks for an excellent video!
@inwhichidie7171
@inwhichidie7171 3 роки тому
Just want you to know you saved my ass with this video. Procrastinated on an assignment for my CS class and this really helped me understand some stuff I'd missed and get the assignment done in time. Thanks a ton!
@randomsalgari
@randomsalgari 2 роки тому
I really love awk, it was one of the main tools I used for my thesis.
@BryanChance
@BryanChance 2 роки тому
Awk and sed one of the most useful and powerful text manipulation and formatting tools I ever learned to use.
@mahmoodabdulla5499
@mahmoodabdulla5499 3 роки тому
This is the best awk tutorial I've seen so far.. please make a video for SED
@stumbling
@stumbling 3 роки тому
Used quite a bit of AWK in my 3rd year physics project. I had hundreds of experimental data files to process and it was a good choice.
@Ureallydontknow
@Ureallydontknow 4 роки тому
high quality video. perfect audio. the pace was perfect. the explanation and examples were perfect.
@talbech
@talbech 4 роки тому
Thanks. Brought back some great memories of data manipulation of huge point cloud datasets on SGIs. We had to do very similar things before piping data into the OpenGL 3D engine for visualisation purposes. Awk is very flexible and fast and still have many usecases in todays system administration tasks.
@monikabalint400
@monikabalint400 3 роки тому
I survived my PhD thanks to awk and sed!! Command line rules!
@adam872
@adam872 4 роки тому
Love me some AWK and have made plenty of use of it over the years.
@MrMusic25
@MrMusic25 3 роки тому
Very glad this video popped up on my feed! I've been currently working with data using sed but after watching this i think awk it much more suited for me, especially knowing I can write my own functions that run faster than Bash can! Great video, thanks for the explanation!
@damiancosta2588
@damiancosta2588 2 роки тому
Gary, awesome job giving me the basic understanding of awk. All my little failed projects have been revived since Your walk thru of the AWK!
@johng7rwf419
@johng7rwf419 4 роки тому
Good old integer arithmetic, takes me back to when I was a lad.. Awk would have been very useful in a former life. Thank you very interesting.
@NexuJin
@NexuJin 4 роки тому
I uses awk/sed on a daily basis at work. I uses AWK primary to analyze excel(exported to csv) or other data files for audits. That is on Windows! In both MINGW64 or WSL2 Linux.
@JR-pk1fr
@JR-pk1fr 3 роки тому
I love it! The best awk demo on UKposts. More awk vids in the future???
@asandax6
@asandax6 2 роки тому
I've been just doing this from any programming language I was learning when I get to the read and write files section of the documentation. Nice to see it can be done directly on the command line.
@senantiasa
@senantiasa 3 роки тому
This is the only skill in my job and my previous job where people turn to no one other than me..:*( Getting sentimental here...
@paschikshehu7988
@paschikshehu7988 3 роки тому
what do you do?
@senantiasa
@senantiasa 3 роки тому
@@paschikshehu7988 Systems engineer, but it's programmers who come to me for this, usually because they need simple parsing or data manipulation which doesn't take a lot of effort. Then, their programs run my AWK script. These programmers know Sed (which is even simpler than AWK), but their case is usually where Sed is too simplistic and using their programming language would be overkill.
@Frankx520
@Frankx520 3 роки тому
kaluq system engineer is so cool. I just found a good PID value for my motor speed control using Matlab earlier today.
@afonsosalbrecht
@afonsosalbrecht 2 роки тому
omg, if you are working as software engineer and they can't do it... change jobs. I doubt your are technically growing in this company hahahah
@aneeshprasobhan
@aneeshprasobhan 2 роки тому
@@Frankx520 he said systems engineer, not Control Engineer.
@shikhanshu
@shikhanshu 4 роки тому
I use awk at my job and I am always in awe of it. This video is a great little intro and the rounding logic was pretty neat too! Thanks Gary!
@timothykeith1367
@timothykeith1367 3 роки тому
gawk
@DeepakKumar-lv4te
@DeepakKumar-lv4te 2 роки тому
surely adding 0.5 to say 2.1 doesn't give the correct rounding integer as it doesn't round up ?
@ORagnar
@ORagnar 3 роки тому
He has the smoothest advertising transitions I've come across. Great job! Great content, too!
@LoneIgadzra
@LoneIgadzra 2 роки тому
For small files there are more user-friendly tools, but awk really shines when you have some huge text file that you need to massage because it is just about as fast as you can get. Really important to know about in those cases, because you could easily be lead down an unnecessarily slow or expensive "big data" path.
@cheaterman49
@cheaterman49 3 роки тому
Thanks Gary, that was simple and useful. I usually write small Python scripts for such data processing because I'm more fluent in it, but if it were CSVs or tab-delimited outputs (like from other shell programs) awk is just way simpler. Always wished I got some proper simple intro to it, now it's done :-) - perhaps you could make a follow-up episode or two? Thanks again!
@hereb4theend
@hereb4theend 4 роки тому
AWK, Sed, Bash, TCL, GREP, Perl and Nvim are my command line friends. 😍
@josephdoyle5304
@josephdoyle5304 3 роки тому
Actually, grep was taken out of the line editor ed. The command in ed is g/RE/p ( globally search for a regular expression and print the line). Hence "grep RE filename" nawk has more capabilties. BTW "awk" are the initials for Aho, Wineberger, and Kerinigan, the developers who created awk.
@hereb4theend
@hereb4theend 3 роки тому
@@josephdoyle5304 you're a prince amongst men. 😊
@thaddeusolczyk5909
@thaddeusolczyk5909 3 роки тому
Philistine emacs!
@zyan983
@zyan983 3 роки тому
@@thaddeusolczyk5909 Emacs is nice, but I don't see a reason to use it, so I stick with nvim.
@AbhishekBM
@AbhishekBM 3 роки тому
@@thaddeusolczyk5909 the command line version of Emacs is terrible.
@websciencenl7994
@websciencenl7994 4 роки тому
Wow, i've just stumbled upon your channel and i'm very very impressed with your teaching skills. Absolutely brilliant. Thank you soooo much for doing this!
@Rovsau
@Rovsau 3 роки тому
Thanks for the info. Spreadsheets are more practical for me, and more practical for newbie experimentation, but AWK really bridges the gap between sheet logic and optimizing work. Plus, you get support from a lot more scripting capabilities. Great stuff!
@apmcd47
@apmcd47 3 роки тому
A long time ago when someone was telling me how wonderful Excel was, I simply said "ed, perl, tbl, troff" as in edit your data using ed (actually, I never use ed), process it with Perl (I don't know awk), and finally format it with troff using the tbl preprocessor.
@FrankyDesign
@FrankyDesign 4 роки тому
Awk is really amaz... Syntax error: Missing ending '}'
@ThePsyForce
@ThePsyForce 3 роки тому
% in vim will skip between matching parentheses
@dosmastrify
@dosmastrify 2 роки тому
Java too
@dosmastrify
@dosmastrify 2 роки тому
Missing bracket here (insert bracket) Extra bracket here (smashes keyboard)
@CARPB147
@CARPB147 2 роки тому
That'll do it.
@MadMetsFan
@MadMetsFan 4 роки тому
I learned a lot of AWK about 20 years ago - very useful
@xtnctr
@xtnctr 3 роки тому
Outstanding explaining skills!
@SpeccyMan
@SpeccyMan 4 роки тому
Just thought I'd explain, that 'up arrow' is a caret or circumflex.
@peppigue
@peppigue 3 роки тому
That's why ppl call it up arrow
@hecko-yes
@hecko-yes 3 роки тому
@@peppigue you wouldn't call v a down arrow even though it's used that way sometimes < > can be less/greater than symbols or angle brackets or left/right arrows, but in a programming context you'd probably use the former ...except when it's a "shift left" operation in which case it'd make sense to call them arrows hm maybe left v and right v??
@randycreasi222
@randycreasi222 3 роки тому
Sometimes people call it "hat" referring to the hat operator in mathematics.
@gorgolyt
@gorgolyt 3 роки тому
Weird 'flex but okay.
@jwadaow
@jwadaow 3 роки тому
@@gorgolyt very circumspect
@basilburgess8415
@basilburgess8415 3 роки тому
I love awk for text formatting and, arguably informal reporting. Also admin scripts. Honestly, though, you can all this and more with PERL, which I recommend.
@xrafter
@xrafter 2 роки тому
Isn't perl a prolang ? Prolang = PROgramming LANGuage
@CARPB147
@CARPB147 2 роки тому
Yes! (upvoted you for being spot on)
@olimpiudehelean5885
@olimpiudehelean5885 Рік тому
This has to be the best clarification i've ever seen . Thanks a lot !
@Chris-op7yt
@Chris-op7yt 4 роки тому
awk is useful as a very short/quick way to get at Nth field in a text file, especially as it treats consecutive delimiters as one. for example, fixed width input files. But where awk really shines is multi-levelled line delimited files, like old style config files etc., as you dont need to write loops and keep flags about which section of the input file you're in.
@spaceiswater6539
@spaceiswater6539 4 роки тому
Please can you make some more AWK videos Gary? I'm learning AWK at the moment spent a few days on it, its hard to learn but the rewards in knowing how to use it is worth the reward. This is a great video to get people into using it and seeing the power of it.
@johnmcginnis5201
@johnmcginnis5201 3 роки тому
1) Learn a middling amount of 'C', K&R please, none of that C++/# crud. 2) Have a good understanding of regular expressions. 3) Realize that each line is processed in the order received by the program statements after BEGIN and before END. Process order can be important.
@xrafter
@xrafter 3 роки тому
@@johnmcginnis5201 Why we need to put the {} between print . What does it mean?
@AllanKobelansky
@AllanKobelansky 3 роки тому
AWK isn’t a number manipulation tool. It’s a text processing tool that can do math. And so much more. Explore GAWK, the Gnu version. And use the tools you know, as best as you can to get the job done. And don’t stop learning.
@12Q46HPRN
@12Q46HPRN 3 роки тому
Excellent! You explained awk very well!
@aminebouaita9202
@aminebouaita9202 3 роки тому
Thank you for the crystal clear demo !
@yjk_ch
@yjk_ch 3 роки тому
I remember using Awk for extracting a column from a command result(using something like {print $1}, but I didn’t know that it could do much more than that.
@oguzaranay
@oguzaranay 4 роки тому
My first time hearing and knowing this language!
@CARPB147
@CARPB147 2 роки тому
Oh, oh. The secret is coming out!
@Mildimage
@Mildimage 3 роки тому
Awesome video man!. This was my first contact with awk command. Very very good explanation!
@jameschums
@jameschums 2 роки тому
I have been using AWK for 20 years, it rocks!
@adityathapan2544
@adityathapan2544 4 роки тому
Your way of explaining topice is very easy... Please make more videos on linux
@richa9719
@richa9719 2 роки тому
I used awk in the early 1990’s as a developer. Not sure it is something that a non developer should really use. Good demo, I wrote complex code with Awk to parse flat files.
@CARPB147
@CARPB147 2 роки тому
That is what AWK is perfect for. Great for processing log files or other UNIX/Linux sysadmin stuff.
@SteveJones172pilot
@SteveJones172pilot 2 роки тому
Not sure a non-developer should be using?! What's wrong with learning to use a tool? Should a non-sysadmin never open a command prompt because they're not an expert?! How do people become developers then? Any tool like this you can learn to use is a huge plus! Let's encourage experimentation and learning!
@CARPB147
@CARPB147 2 роки тому
@@SteveJones172pilot - Totally agree with your sentiment on this. People will either be interested (or not) in doing this stuff. That will naturally weed out people that program (programmers/developers, etc.) from people that don't. I don't see any reason to have arbitrary mandates against writing AWK commands (or scripts) for people only because they are not *professional* developers. Anyhow, the 40+ year secret is out! 😏😆
@CARPB147
@CARPB147 2 роки тому
Oddly, my very first AWK script was my most complex! Only a page and a half, but it replaced a 40-page SQR program that tried to parse CSV files (ugh) written by a hammer who thought every problem looked like a nail. After that I would use it in smaller piped sequences with several AWK commands like: awk '{if ( FNR == 1 ){print "FILENAME=",FILENAME}; if (NF && $0 !~ /^--/){print}}' Database/*.sql \ | awk '/^FILENAME=/{files++}; $0!~/FILENAME=/ && NF {loc++}; END{avgloc=loc/files; printf "%d Database LoC in %d files at avg lines per file = %0.f ", loc, files, avgloc}' > $countfile (sorry about the look of the run-in line). For more complex problems, like ETL cases, etc., I just used Perl which was a natural progression from using Shell + AWK.
@merlin-ju6fu
@merlin-ju6fu 2 роки тому
This is the first I have heard of AWK. I am number crunching sports recreational sports handicapper, so AWK might be useful to me.
@SteveJones172pilot
@SteveJones172pilot 2 роки тому
Great video! I have always used grep to search strings in linux and never bothered to figure out what awk did.. This was a great introduction - Just what I need so that next time I have a use case I will remember this and figure out how to do it in awk!
@1MarkKeller
@1MarkKeller 4 роки тому
*GARY!!!* *Good Morning Professor!* *Good Morning Fellow Classmates!*
@GaryExplains
@GaryExplains 4 роки тому
MARK!!!
@jamess1787
@jamess1787 4 роки тому
Mark, sit back down and turn to page 33 in the 2020 edition of GE
@nickharrison3748
@nickharrison3748 3 роки тому
awk -F "/" {print ...} . for specifying the different seperator other than default whitespace
@dmays67
@dmays67 3 дні тому
Currently assessing how to extract useful data from multiple differently formatted fuel receipts here. Found your lovely little primer video very helpful - thanks!
@GaryExplains
@GaryExplains 3 дні тому
Glad it was helpful!
@greyman1104
@greyman1104 4 роки тому
Haven't understood awk before. Thanks, Gary!
@villesyrjala3354
@villesyrjala3354 4 роки тому
I've used awk to extract useful information from pdf documents. The problem was that the information was awkwardly (pun intended) split into several tables throughout the document so I had to first process each table to collect up all the pieces for each element I wanted to output. The solution I came up with was pdttotext + awk to do the processing. The few hours I spent on that awk script has paid off nicely since I've had to reprocess new versions of the same document several times over the years. The alternatives would have been: a) Manually copy paste all the information. One thing I've learned over the years is you *never* trust anything copy pasted by a human (least of all myself)! Also would have been extremely tedious (which adds to the chance to making a mistake), and I would've had to repeat it whenever a new version of the document came out. b) Find some pdf library for my favorite programming language to extract more structured data from the document. Couldn't quickly find anything that worked and I didn't want to start debugging pdf libraries.
@PraveenKumar-xq7xb
@PraveenKumar-xq7xb 4 роки тому
Hi I am interested in pdf extraction. Can you kind of give some clue codes to me to explore further.
@mychromebook9935
@mychromebook9935 3 роки тому
Another solution is to use a command line pdf editing tool called, pdfTK. You can read out pdf files from command line and even fill in pdf forms with it.
@stevebabiak6997
@stevebabiak6997 3 роки тому
IIRC, Perl has some modules (think libraries) for handling PDF files, and Excel files too.
@CARPB147
@CARPB147 2 роки тому
Cool.
@robbo916
@robbo916 4 роки тому
I won't go into the specifics but AWK holds a special place in my heart. I know that might sound a bit weird but it's true. Even though I've only ever had to use it in anger twice it was well worth learning just for them.
@philipcoltharp918
@philipcoltharp918 2 роки тому
Thanks, Im glad I clicked in. I never would have searched out this otherwise. I do use SED, GREP, and GVIM. The next time I have the opportunity, I'll have to try to apply these lessons.
@rish1459
@rish1459 3 роки тому
Regex, SED, & AWK are awesome tools!
@mywebuniversity
@mywebuniversity Рік тому
Great quick demo of awk power.
@lactobacillusprime
@lactobacillusprime 4 роки тому
Databases! I was using SQL and databases / Dbase for a long time. Can't stand using spreadsheets as databases.
@makoto_0
@makoto_0 4 роки тому
Spreadsheet is just for office work, can't do anything for big data (It blows up at the moment you open the file). Database is the real deal.
@1MinuteFlipDoc
@1MinuteFlipDoc 4 роки тому
the right tool for the right job! Nobody ever: I hate having to commute from LA to NY on a skateboard!
@jamess1787
@jamess1787 4 роки тому
AMEN
@kencheng2929
@kencheng2929 4 роки тому
Hi, I’m not a db admin but my feeling is spreadsheets are easier to use and they’re right in front of you. Databases need some kind of ui or they use the cli (inserts, selects). Please confirm/correct.
@jamess1787
@jamess1787 4 роки тому
@@kencheng2929 hi Ken, you have a valid point. If you have a small set of data points to keep track of: then spreadsheets make sense. When you start to get into the 1000's+ then it's time to start looking into a database solution. Spreadsheets should be more for temporary data that has no long-term value. Like forecasting or basic customer metrics. =)
@ricsanders69
@ricsanders69 4 роки тому
Reminds me of my days on the Sparc 2!! :-D Those were the days. *sigh*
@mfolarin
@mfolarin 3 роки тому
Gary! I'm excited to find your channel. Pleasing. Subscribed!
@shaileshsharma1173
@shaileshsharma1173 4 роки тому
Thanks Gary for explaining awk in cmd
@watcherquek263
@watcherquek263 4 роки тому
perl >> (sed, awk ). You can do all of sed and awk in perl (and there are even conversion scripts for it, called a2p and s2p) but not the other way.
@jrd33
@jrd33 4 роки тому
Sure. And an 18-wheeler can carry more than a pickup. But a lot of people find a pickup works just fine for day-to-day tasks.
@CARPB147
@CARPB147 2 роки тому
@@jrd33 - Certainly. There are tools more suited for certain jobs than others. I think it is good to have variety of choice.
@jzmmm
@jzmmm 4 роки тому
In the early 90s: hey everyone, learn guis!! Today: hey let's go back to the command line!!!
@Hassan8Ola
@Hassan8Ola 4 роки тому
GUIs are good for repeated, error-prone tasks. If you find yourself doing a task over and over again in which the task never changes, then build a GUI for it. But probably, that it is not likely, since the task can always improve and change. If you can isolate something so well that it can get its own GUI, then go for it. Nowadays, that is not easy to do.
@walker9893
@walker9893 4 роки тому
@@Hassan8Ola this seems like the criteria for scripted automation....
@xijinpingpong4426
@xijinpingpong4426 3 роки тому
GUI is nice if you need to see some visualized information or for entertainment. Terminal is nice for fast programs that have a specific task and work together with other programs. People who refuse one of them (GUI or Terminal) limit them self.
@diederick76
@diederick76 3 роки тому
I think the general idea in the 90s was that for GUIs you didn't have to learn anything.
@MsHojat
@MsHojat 3 роки тому
There's nothing stopping a program that is GUI that has all the functionality of a command line program, or even having a command line entry area inside of it. The problem is more with the fact that most or practically all GUI programs don't do this for some stupid reason!
@prabhujeeva2228
@prabhujeeva2228 4 роки тому
Thanks Garry!!. It's really interesting
@pierrec1590
@pierrec1590 2 роки тому
My favorite tool for making sense out of long log files.
@jinchoung
@jinchoung 4 роки тому
subscribed. dammit, I'm not a coder (much of) but you made that understandable even while talking blisteringly fast! kudos.
@CARPB147
@CARPB147 2 роки тому
You can slow playback of UKposts videos when clicking on the cogwheel icon and selecting your playback speed.
@trueriver1950
@trueriver1950 4 роки тому
awk one liners are great for ad hoc queries and I use it for that, but as soon as you go to scripting surely perl is the way to go? Or if you don't already know perl, then maybe Python which is more friendly for beginners?
@jrd33
@jrd33 4 роки тому
Awk is great for awk-shaped problems (basically, report generation on files of simply-formatted ASCII data). If you have a different-shaped problem, don't use awk.
@Masqueey
@Masqueey 2 роки тому
Finally a concise awk tutorial! Thanks!
@huistelefoon5375
@huistelefoon5375 Рік тому
AWK has been used to create a full parser/tokenizer, and other purposes that are arguably way more complex for its intended use. Using AWK you can also make advantage of pattern matching with regular expressions, and AWK has many other tools for text manipulation. But I think one of the most powerful aspects of AWK is using it as a complimentary Unix tool. Use it together with other Unix command-line utilities with pipelining, not everything has to be done in AWK. For example, you can use AWK to parse out formatted words from a complex text file, and now pipe this data to be processed by another utility.
@marcoandreknottjung3418
@marcoandreknottjung3418 4 роки тому
Just a question from a newbie: what can I do with those informations? I come to your channel, via ColdFusion and the graphene battery! Thanks in advance
@fuseteam
@fuseteam 4 роки тому
anything you want really ;)
@cfbasz
@cfbasz 4 роки тому
You can manipulate information from files and extract what you want in the way you need. It is just pure formated text being manipulated. No spreadsheets needed. Cheers!
@hextz
@hextz 4 роки тому
you can redirect the formated output of the awk script to another file, for example: I wanted to create a test file like the one used in the video but didn't know how to do it using only ls, so I used a "ls -la /usr/bin > ls-output.txt", then used awk to select only the fields in the order I wanted with "awk '{print $9,$5} ls-output.txt > ls-awk-output.txt". It's very handy to manipulate formated text files like csv, config files, logs, program outputs, whatever you can imagine...
@berndeckenfels
@berndeckenfels 4 роки тому
See 14:47 for example
@claudehebert3131
@claudehebert3131 4 роки тому
One example: Extract data from a not very user-friendly system, in a tab-delimited format. Convert it into SQL commands (using loads of "printf"). Run the generated SQL code to load the data in a database. AWK can be the glue between otherwise incompatible systems.
@harrikoivula3932
@harrikoivula3932 3 роки тому
I used to use GREP, AWK and SED in the 80's while porting a CAD program from on operating system to other. But nowdays I tend to use PERL and many times with excel. You can do many things with excel, but complex data manipulation tasks are much easier with perl. One of the best concepts in data manipulation with PERL and AWK are associative arrays.
@dragonsage6909
@dragonsage6909 Рік тому
Great tutorial, subbed.. thank you!
@pfsmith007
@pfsmith007 3 роки тому
This is a great tool. Thanks for sharing!
@khatharrmalkavian3306
@khatharrmalkavian3306 3 роки тому
Kay, maybe if - for god knows what reason - I'm writing a super complex bash script. Even then, probably not. I generally just sub in a proper scripting language for that.
@hinkhall5291
@hinkhall5291 2 роки тому
Most young devs don’t even know about commands that aren’t cd, ls, mv, cp or docker.
@xrafter
@xrafter 2 роки тому
pacman -S firefox . Help this line above doesn't work . The error is weird 😞
@not_herobrine3752
@not_herobrine3752 Рік тому
they have heard about the command line?
@wherami
@wherami 3 роки тому
Great video. Essential for server administration
@chitalvision
@chitalvision 4 роки тому
I'm actually enjoying these technical videos of late!
@HeavenlyEx
@HeavenlyEx 3 роки тому
Why is everyone comparing excel with AWK? It doenst make any sense, AWK is a programming language, excel is a software. Excel might very well use AWK below the Graphical Interface. AWK is used to script data manipulation procedures, excel is used for declarative data transformations. Excel is just for accountants, awk is for engineers
@lacs83
@lacs83 3 роки тому
An extremely accurate comment.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 4 роки тому
Every time I hear the word “Awk”, I reach for my Perl.
@jamess1787
@jamess1787 4 роки тому
Oh no. Not nondescernible perl. You're that guy from stack overflow? Always posting a solution in perl that no one understands. 😂
@lawrencedoliveiro9104
@lawrencedoliveiro9104 4 роки тому
@@jamess1787 I don’t claim to be a Perl expert. But I know more Perl than I do Awk, and I do know that Perl can do everything Awk can do, just as concisely, and more.
@TerenceKearns
@TerenceKearns 4 роки тому
I used to work in the IT deptartment at a university. We soon realised that the entire university IT infrastructure was glued together with perl scripts all over the place. They were written by one dude over the decause. He ended up being the department head. His name was bob. We just called them .bob scripts. He retired during my tenure there. To this day, there will still be .bob scripts in the uni it matrix holding certain things together.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 4 роки тому
@@TerenceKearns That was an absolutely ubiquitous use of Perl. It made it so much faster to throw together quick utility programs, rather than having to write C/C++ or even Java code. And the ever-growing collection of add-on modules collected at CPAN let you interface to network stacks, graphics APIs, DBMSes-just about anything you need to handle the low-level stuff that was not built into Perl itself. That was the model that Python followed-and took to the next level.
@jinchoung
@jinchoung 4 роки тому
such a perl clutcher
@kkroxe
@kkroxe 3 роки тому
Brilliantly explained thank you
@glmchn
@glmchn 3 роки тому
Hell yeah !
@weihanngan2993
@weihanngan2993 4 роки тому
Nice sharing! Thanks Gary!
@ibuprofenPill
@ibuprofenPill 2 роки тому
As a senior software engineer, I understand the advantages of what you’re demonstrating. However, the common person will never use this on a wide basis. But, your heart is in the right place.
@johnmcginnis5201
@johnmcginnis5201 2 роки тому
That is indeed a problem. I have overcome it for many tasks for mere mortals by writing awk code for the task then front ending that with zenity. Good enough that when I need to see the division manager she makes sure I am at the top of the list in the morning. :)
@CARPB147
@CARPB147 2 роки тому
@@johnmcginnis5201 - I had the same experience. I remember the first time I took a *formatted report*, ran it through AWK, and provided my astonished manager with information she needed selected and totaled in a totally different way in a matter of minutes.
@not_herobrine3752
@not_herobrine3752 Рік тому
yeah the comment section goes "just use python"
@syte_y
@syte_y 5 місяців тому
When i was doing a lot of data processing on csv files this would’ve been useful. don’t think it applies to a lot of people like you said though
@piiumlkj6497
@piiumlkj6497 4 роки тому
Let's become terminal ninjas ;) , AWK is very used in linux commands
@jpdj2715
@jpdj2715 3 роки тому
What do you expect from something that was developed in the terminal age? First stable release 1985. Developed by Aho, Weinberger and Kernighan (yes the Kernighan who wrote "The C Programming Language" with colleague Ritchie 1st ed. 1978). Or, when Linus scribbled his Ux, awk was already age old.
@uhmasyt
@uhmasyt 3 роки тому
awk is slow, too. I remember just moving a script from awk to Perl I could reduce processing time by 70% and ended up with something like 30 minutes on a well equipped Unix machine.
@piiumlkj6497
@piiumlkj6497 3 роки тому
Why perl when you've got python which has a much better syntax ? The best tool is the one available to you and the one you feel most comfortable using .
@lxathu
@lxathu 3 роки тому
@@uhmasyt Really complex matches that perl can do in one step with its advanced regexps but one must has to write subroutines for can lead to perl's victory but most of the cases the burden that comes with that draws perl back. Awk if FAST with the task it was designed for.
@CARPB147
@CARPB147 2 роки тому
@@lxathu - "but one must has to write subroutines for can lead to perl's victory". Not always. We can write Perl one-liners about as well as we can write AWK one-liners (that is, an entire script in a single command, without script files, or subroutines). It depends on the problem being solved, of course. Perl is pre-compiled and will run faster than AWK in most (all?) cases, and certainly scales-up more gracefully to solve more complex problems.
@oxynetz
@oxynetz 2 роки тому
'Gentle introduction to awk' .... gentle if you're like Gary... Thanks for this
@smithwill9952
@smithwill9952 3 роки тому
excellent intro in awk. GBU!
Awk Crash Course
40:38
Earthly
Переглядів 8 тис.
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Переглядів 115 тис.
Спаси её волосы🙏🏻
00:40
БРУНО
Переглядів 1,7 млн
Why Use CAT Or GREP When You Can AWK?
11:13
DistroTube
Переглядів 75 тис.
An AWK love story -- Cody Mello
21:59
Systems We Love
Переглядів 15 тис.
Unix vs Linux
13:59
Gary Explains
Переглядів 1,6 млн
The Windows Source Code Revealed: Task Manager (E01)
27:11
Dave's Garage
Переглядів 435 тис.
18 Commands That Will Change The Way You Use Linux Forever
29:50
Akamai Developer
Переглядів 1,2 млн
Awk: Hack the planet['s text]! (Presentation) - 2023 Update
1:07:40
Benjamin Porter
Переглядів 15 тис.
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Переглядів 254 тис.
25 Nooby Pandas Coding Mistakes You Should NEVER make.
11:30
Rob Mulla
Переглядів 253 тис.
My 5 Favorite Linux Shell Tricks for SPEEEEEED (and efficiency)
11:06
tutoriaLinux
Переглядів 640 тис.