jeroenjanssens / data-science-at-the-command-line

Data Science at the Command Line
https://datascienceatthecommandline.com
Other
3.79k stars 764 forks source link

code typo in Chapter 5 overview #98

Closed julianhatwell closed 4 years ago

julianhatwell commented 4 years ago

The opening code example is given as:

$ echo 'foo\nbar\nfoo' | sort | uniq -c | sort -nr 2 foo 1 bar $ echo 'foo\nbar\nfoo' | sort | uniq -c | sort -nr |

but should be:

$ echo -e 'foo\nbar\nfoo' | sort | uniq -c | sort -nr 2 foo 1 bar $ echo -e 'foo\nbar\nfoo' | sort | uniq -c | sort -nr |

-e switch is required for interpolating escaped \n. Without it, the example doesn't work.

jeroenjanssens commented 4 years ago

Thanks for this. I think you're using a different version of echo. Both the BSD version of echo and the Bash builtin work without the -e option. I won't change this, because I have started working on the second edition, but I will pay attention to this when I get to Chapter 5. Thanks again.