How to use the cat command to find a specific word in a textfile

52,200

You can do it by grep. You do not need cat for that.

grep -w war file_name

You can use cat too, if you like

cat file_name | grep -w war

but it is longer.

Share:
52,200

Related videos on Youtube

B0neCh3wer
Author by

B0neCh3wer

I am just an ordinary person, nothing special about me, I am currently learning to code and i Looking forward to helping people with their Python problems as well as receiving a tad bit of help myself

Updated on September 18, 2022

Comments

  • B0neCh3wer
    B0neCh3wer over 1 year

    I did some research but I was unable to find anything to help, I need to find the word "war" in a text file, I know that I can use the cat command, but I need to modify it somehow, can someone help?

    • Jacob Vlijm
      Jacob Vlijm about 7 years
      I am pretty sure I saw a question like this before. What is the assignment?
    • B0neCh3wer
      B0neCh3wer about 7 years
      Not an assignment, just trying to get used to working with a few basic commands, I've used Ubuntu all my life, but I've only just started exploring the Terminal, always been afraid of braking it somehow xD
  • B0neCh3wer
    B0neCh3wer about 7 years
    I tried this, and now it's not letting me do any commands, but I can type stuff, how do I get back to my command line?
  • Pilot6
    Pilot6 about 7 years
    Press Ctrl+C probably ;-)
  • Pilot6
    Pilot6 about 7 years
    I think it is a duplicate of something. I can't imagine nobody asked it.