r/linux4noobs • • Sep 08 '22
learning/research What does this command do?
fuck /u/spez
Comment edited and account deleted because of Reddit API changes of June 2023.
Come over https://lemmy.world/
Here's everything you should know about Lemmy and the Fediverse: https://lemmy.world/post/37906
92
Upvotes
View all comments
Show parent comment
2
u/whetu Sep 08 '22 edited Sep 08 '22
Not from a Jedi...
You could check out /r/linuxupskillchallenge/ I don't know if it's any good because I have no time to do it myself, but it might be something. There's also The Missing Semester which you can find on Youtube. Also, check out /r/bash and /r/awk, specifically the sidebar of /r/bash. /r/commandline may also be worth subbing to as well.
You'll get a broader mix of possible paths from those starting points. Two things I will say, though:
Treat the Advanced Bash Scripting guide with suspicion. It is outdated, it teaches bad practices, its author has refused to accept contributions and has refused to fix obvious flaws
No problem :)
One other thing, to bring a few of my earlier points together. Let's take this from the original one-liner:
Because that's splitting on whitespace, that means that in the situation where there's a filename with a space in it, it will be incomplete e.g.
That works because there's no space in
/tmp/#9699338. But compare with:See how in the second example, only the first word of the filename
legit filename.txtis selected?Our use of
'as a delimiter resolves that issue.Lastly, consider the power of this for simple csv parsing e.g.
awk -F ',' '{print $3,$4}' something.csvand other delimiters e.g.