2

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?

closed as unclear what you're asking by Kevin Bowen, waltinator, Zanna, Eric Carvalho, MadMike Mar 14 '17 at 9:36

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    I am pretty sure I saw a question like this before. What is the assignment? – Jacob Vlijm Mar 10 '17 at 12:21
  • 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 Mar 10 '17 at 12:25
8

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.

  • 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? – B0neCh3wer Mar 10 '17 at 12:20
  • Press Ctrl+C probably ;-) – Pilot6 Mar 10 '17 at 12:21
  • I think it is a duplicate of something. I can't imagine nobody asked it. – Pilot6 Mar 10 '17 at 12:26

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