Live data from Hacker News

An introduction to data processing on the Linux command line

blog.robertelder.org

21–30 of 73 posts

Re: An introduction to data processing on the Linux command line

#21
post #15

Can somebody explain the advantage of doing it on the command line vs in Python or R? What would a practical use case look like?

Please see my comment to this thread (which links to one of my past comments): https://news.ycombinator.com/item?id=21614511

Re: An introduction to data processing on the Linux command line

#22

Why people use Linux in place of *nix ? Even worst, most of the tools (cat, grep, awk) are Unix commands, redeveloped by the GNU project in most of the GNULinux distros.

Yep. And the vast majority of these tools exist on systems that share virtually zero heritage with Linux or GNU. (Like macOS).

Oh well, I guess a lot of people just think all Unix-like systems are called “Linux” now. Perhaps it’s become like the word “Kleenex”.

Re: An introduction to data processing on the Linux command line

#23

Hi, (I wrote the article). A few people commented noting that I included "Data Science" in the title, but the content doesn't include any statistics or machine learning which is closer to the core definition of 'data science'. I still think the title is appropriate since any kind of low-fidelity data science task you do on some had-hoc data (log files, heaps of text, web pages) is going to start with setting up a pro…

Interesting.

For anyone who is interested in going a little deeper into data science, I’d also recommend the “Introduction to Data Science with R” series by David Langer:

https://youtu.be/32o0DnuRjfg

Re: An introduction to data processing on the Linux command line

#24
post #20

Useless use of cat detected! Rememeber, nearly all cases where you have: cat file | some_command and its args ... you can rewrite it as: and in some cases, such as this one, you can move the filename to the arglist as in: some_command and its args ... file — Randal L. Schwartz ( http://porkmail.org/era/unix/award.html#cat )

hah, I knew someone would point that out (which is why I talked about it in the article).

I actually prefer useless cat because when you're prototyping a pipeline it's very awkward to use non-useless cat. You'll probably start off with something like this to observe the content of the file:

    cat something.txt
Using this doesn't work in bash:

    
Then, continuing with useless cat to build on it you do

    cat something.txt | grep stuff
Which you can type easily from using 'up' in your terminal. But if you use non-useless cat you have to re-type the entire thing or move the cursor around:

    grep stuff 
With useless cat, you can keep adding things and check the result:

    cat something.txt | grep stuff | sed 's/"//g'
Or if you need to insert another filter before the last stage like this, you can just press "up" and insert it:

    cat something.txt | grep -v negmatch | grep stuff
I don't think there is any easily-typed equivalent workflow with non-useless cat.

Re: An introduction to data processing on the Linux command line

#25
post #20

Useless use of cat detected! Rememeber, nearly all cases where you have: cat file | some_command and its args ... you can rewrite it as: and in some cases, such as this one, you can move the filename to the arglist as in: some_command and its args ... file — Randal L. Schwartz ( http://porkmail.org/era/unix/award.html#cat )

hah, I knew someone would point that out (which is why I talked about it in the article). I actually prefer useless cat because when you're prototyping a pipeline it's very awkward to use non-useless cat. You'll probably start off with something like this to observe the content of the file: cat something.txt Using this doesn't work in bash: Then, continuing with useless cat to build on it you do cat something.txt | g…

If you’re working with a lot of data you probably want to pipe it into head anyway, initially, so

Can be the starting command. When you no longer need the head there, just get rid of “head |”.

Although I agree that the pointing out of “useless cat” is usually not particularly useful or constructive.

Re: An introduction to data processing on the Linux command line

#26
post #25

Earlier quoted context omitted.

hah, I knew someone would point that out (which is why I talked about it in the article). I actually prefer useless cat because when you're prototyping a pipeline it's very awkward to use non-useless cat. You'll probably start off with something like this to observe the content of the file: cat something.txt Using this doesn't work in bash: Then, continuing with useless cat to build on it you do cat something.txt | g…

If you’re working with a lot of data you probably want to pipe it into head anyway, initially, so Can be the starting command. When you no longer need the head there, just get rid of “head |”. Although I agree that the pointing out of “useless cat” is usually not particularly useful or constructive.

Using head when there's lots of data make sense, but I really don't see any advantage to avoiding useless cat. Useless cat is way faster to type and make additions to. I sort of get the feeling that 'useless cat' is really just a fun copypasta kinda like when people like post "I'd just like to interject for a moment. What you're referring to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it..."

Re: An introduction to data processing on the Linux command line

#27

Why people use Linux in place of *nix ? Even worst, most of the tools (cat, grep, awk) are Unix commands, redeveloped by the GNU project in most of the GNULinux distros.

To be fair, in many cases (such as grep), the GNU commands have additional features and are more intuitive to use than the standard POSIX implementations.

Re: An introduction to data processing on the Linux command line

#28

Hi, (I wrote the article). A few people commented noting that I included "Data Science" in the title, but the content doesn't include any statistics or machine learning which is closer to the core definition of 'data science'. I still think the title is appropriate since any kind of low-fidelity data science task you do on some had-hoc data (log files, heaps of text, web pages) is going to start with setting up a pro…

You forgot an important one: man
Post reply on HN