Enough of the bloat! You don’t need to use cat, grep, head, sed, etc. All you need is AWK!
REFERENCED:
►
WANT TO SUPPORT THE CHANNEL?
💰 Patreon:
💳 Paypal:
🛍️ Amazon:
👕 Teespring:
SOCIAL PLATFORMS:
🗨️ Mastodon:
💬 IRC: irc://freenode #distrotube
👫 Reddit:
DT ON THE WEB:
🕸️ Website:
🌐 Gopherhole: gopher://distro.tube
📁 GitLab:
FREE AND OPEN SOURCE SOFTWARE THAT I USE:
📽️ Open Broadcaster Software:
🎬 Kdenlive:
🎨 GIMP:
🔊 Audacity:
💻 VirtualBox:
Your support is very much appreciated. Thanks, guys!
Nguồn: https://codeigniterbrasil.com
Xem thêm bài viết khác: https://codeigniterbrasil.com/lap-trinh-linux/
Xem thêm Bài Viết:
- Hướng dẫn sử dụng hệ điều hành linux siêu tốc – bài 25 Xem cấu hình hệ thống (cpu, ram, hdd)
- Linux cat command summary with examples
- Cài nhiều hệ điều hành Windows và Linux trên một máy tính
- Hướng dẫn tạo USB Boot DLC2019 (NTFS / UEFI) Trên windows 10 ( sử dụng USB 32 GB )
- Hướng dẫn gỡ bỏ Ubuntu sạch sẽ nhất bằng lệnh trên Windows theo chuẩn UEFI-GPT
maximilian2000
April 16, 2020Just one day after Luke Smith's video.
https://youtu.be/82NBMvx6vFY
Anders Jackson
April 16, 2020From the Professor K from awk(1) talks about grep(1): https://www.youtube.com/watch?v=NTfOnGZUZDk
Knack Wurst
April 16, 2020https://youtu.be/_q6Uj4X_knc?t=713 quote: "you can use awk to just print out every line in a file, … although that's kinda dumb, you would probably just use cat or something like that" I like your video and that you have encouraged me to go out and learn awk. Though I would have to disagree with replacing cat and grep with awk. I understand I could just use awk to accomplish what those programs do, however, am I supposed to remove cat and grep from my system and possibly break something that depends on them and expects them to exist? Maybe I should write aliases for cat but then if I am mimicking cat `alias cat=awk '{print}'` why not just use cat if I need a simple dump of the file. Though looking at the man page for cat reveals its simplicity, perhaps it should not be shipped by default.
Sergio Díaz Nila
April 16, 2020Now you filthy mortal, shut up about GREP and get ready to listen to the Grand Brian Kernighan https://www.youtube.com/watch?v=NTfOnGZUZDk
D M
April 16, 2020UNIX philosophy, use programs that do just one thing but they do it very well, and compose them via pipes or scripts to do what you need.
awk is doing too much and misses the point
to use those programs that do 1 thing to do that 1 thing and not another.
`cat` works in pair with `split`, you use `split` to split a single file into multiple files "aa ab ac ad" then you work with them compress them do whatever the fuck you want with them and when you are finished you do `cat aa ab ac ad > file` to get file back at you.
one use case could be spliting a sensitive file into multiple parts, process them separately (compression, cryptography, etc), and send the parts through different channels to the destiny so in the destiny they process them back and cat them back together in the original file.
Sergio Díaz Nila
April 16, 2020why use awk when we can use perl/ruby/python/cl/guile/st/haskell? for everything.
the answer is very simple, because UNIX philosophy is to have programs that do one thing very well.
cat is meant to concatenate files and print them to the STDOUT so you can use the result in some other place, it's goal isn't to print in the terminal anything to read, that would be the pager.
Semjon Kerner
April 16, 2020I can tell you why people cat foo| grep bar. Because it is the number one example for pipes and almost no tutor ever tells them to read manpages and understand what is going on there.
Akami Channel
April 16, 2020Why awk when you can python!? : )
Akami Channel
April 16, 2020If you have a long chain of commands, it may assist in readability to cat file | at the beginning.
Christopher Iwen
April 16, 2020awk '{print $0} (NR==11){exit}' new.sh seems easier to understand and use than what you used for the head example . great video by the way!!
Vanderfleet Martin
April 16, 2020I believe that the Unix philosophy is small single purpose tools that do one thing well. That is why you would use grep instead of awk, not to mention that the grep command line was very much simpler and easier to remember than the awk equivalent. That said, this was a very interesting video on how the same things can be accomplished with different tools.
ARI ATH YF
April 16, 2020Isn't avoiding to mention Luke's name as the source of the vid a bit insulting?
On the topic, what about performance?
Some tools are lighter than others that's why they fit well the use case.
kungfumachinist
April 16, 2020Blargh! Captain Pedantic here… it's not "case insensitive" it's "case indifferent". It's the same difference as "uninterested" and "disinterested".
Kenny Heimbuch
April 16, 2020Amazing that AWK has been around since 1977!
Steve Spirk
April 16, 2020Awk is 671KB, plus 34K for the links from /usr/bin/awk -> /usr/bin/gawk. Cat, grep, sed, head, and tail are 475KB combined. Awk is teh B|0@t!
Platinum Claridge
April 16, 2020Advocates using Unix programs… then proceeds to recommend using one program for everything. Hmmm. Derek, I usually enjoy your videos, but you completely misunderstood the point Luke was making in his video. Might want to rewatch it.
zeyad kenawi
April 16, 2020bat is the coolest
Daniel Huston
April 16, 2020I was hoping to learn something about AWK itself. Instead, you spend too much time disparaging CAT & GREP.
dranenko
April 16, 2020Master this is reveling to me now I'll use AWK for my log and Metadata work.
Mayur Chavhan
April 16, 2020AWK for print file content?!! I prefer "MORE" tools.
Ron Obvious
April 16, 2020Why use cat? Well, cat <filename> is a lot easier to type out than awk '{print $0}' <filename>. The awk version of case insensitive grep is even worse since you have to explicitly call out each character that might be in both upper and lower case. awk does have some really useful stuff though. I'll have to dig into it further.
Jan Schmitt
April 16, 2020Thanks for the comparison but to me it remains more tedious to use awk before ripgrep, grep…you name it..in most cases. Anyway still learned something new, thanks for that.
Antonov Scheeeschslav
April 16, 2020I like this channel
Mastan J
April 16, 2020Even I have this kind of doubt in my mind