0

enter image description here

I can't seem to answer this question:

Use the command wc to count the number of words in the file /course/linuxgym/gutenberg/0ws0310.txt. Store the exact output of the wc command when used with the "word counts" option into the file count.txt. Ensure that the filename within the file contains the full pathname.

6
  • 1
    What have you tried? What result did you get? Please edit your question and add those details. – Andy Dalton Mar 30 '20 at 13:45
  • 1
    Welcome to Unix Stackexchange! You can take the tour first and then learn How to Ask a good question. This'll make it easier for us to help you. – andcoz Mar 30 '20 at 13:48
  • Where is this question from? Are you taking a class, or online assessment? – Jeff Schaller Mar 30 '20 at 13:53
  • Please post text as text. Pictures of text are hard to read. Especially my blind people. – ctrl-alt-delor Mar 30 '20 at 14:34
  • First no need to touch that file. 2nd look at your 3rd line. What is it that you are re-directing? – ctrl-alt-delor Mar 30 '20 at 14:36
0

The question in your assignment asks you to use the "word count option" of wc. To find out what option this is, you need to read the wc manual. You do this with man wc in a terminal.

Once you have found what option is needed to only get the word count (and no other count), you need to run the command on the file /course/linuxgym/gutenberg/0ws0310.txt while at the same time redirecting the output to a file called count.txt. You do this with

wc (insert word count option here) /course/linuxgym/gutenberg/0ws0310.txt >count.txt

If you want to make sure that the output file is located in your home directory, use ~/count.txt in the redirection in place of count.txt, or just give the command cd first to make your home directory your current directory.

There is no need to touch the count.txt file first as redirecting to it will create it if it does not already exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.