I have a school assignment, which says the following:
Use the
cat
command, suitably modified, to show only the last paragraph in thetextfile
I have already checked on https://unix.stackexchange.com/questions/308032/modifying-cat-command-to-number-paragraphs-and-display-last-paragraph-only, but it wasn’t very helpful.
I am aware that you can do this without cat
, but my school says I have to use the cat
command.
Thanks! 😉
Edit: I used cat -n thefile | tail -n1
and it worked perfectly. Thank you Peter Bowyer!
Advertisement
Answer
Assuming that you had one paragraph per line…..
cat -n thefile | tail -n1