Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).
RSS cloud
Jump to:

Output for Question 2 in Exercise 3

1 of 390 articles shown, currently no other people reading this forum.
From: Christopher M.
Date: Mon 30th Mar 2020, 2:15pm


"Khushboo Soni" <22*3*7*[email protected]*u*e*t*u*a*e*u*a*> wrote:

> I'm using the same command and the output is totally incorrect. I am also getting 
> duplicate words. Not sure what is going wrong.
> $ cat unix-1969-1971.txt | tr -d "[:digit:][:punct:]" | sort -u | tr -s " " "\n"


When you have a problem like this - unexpected output from a long pipeline of commands - 
perform each of the subparts of the command "by hand" to ensure that what you *hope* is 
passing through each pipe is really what's happening.

For example, with your command, try the subparts:

shell>  cat unix-1969-1971.txt | tr -d "[:digit:][:punct:]"

shell>  cat unix-1969-1971.txt | tr -d "[:digit:][:punct:]" | sort -u

and so on  (in fact, that very first subpart is not doing what you want it to do).
I hope that that helps.


Incidently, we never need to run:

shell>  cat filename | command ...

as we can run (the quicker)

shell>  command .... < filename

Related articles

Output for Question 2 in Exercise 3 (all 9) RSS
├─ original   Thu 26th Mar 2020, 9:54pm, Rohit A.
├─ reply 1   Thu 26th Mar 2020, 10:13pm, David M.
├─ reply 2   Thu 26th Mar 2020, 10:17pm, David M.
├─ reply 3   Mon 30th Mar 2020, 2:00pm, Khushboo S.
├─ THIS   Mon 30th Mar 2020, 2:15pm, Christopher M.
├─ reply 5 🍺 Thu 2nd Apr 2020, 2:11pm, Rohit A.  O.P.
├─ reply 6   Thu 2nd Apr 2020, 5:49pm, Khushboo S.
├─ reply 7   Thu 2nd Apr 2020, 6:27pm, David M.
└─ reply 8   Thu 2nd Apr 2020, 6:56pm, Christopher M.
This Page

Program written by: [email protected]
Feedback welcome
Last modified:  2:34pm Sep 18 2020