I would like to highlight particular parts of the text using cat. How is this possible? The answer is cat filename | grep word Thanks for the help

closed as unclear what you're asking by Dmitry Grigoryev, dr01, HalosGhost, user181255, techraf Nov 23 '16 at 15:37

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.

  • 1
    I don't understand your question. Do you use cat inside pico? Or, do you want to highlight text in pico whichout using cat? I dontt understand... – Tobias Nov 23 '16 at 15:08
  • I created a text file and I would like to, specifically, use the cat command to highlight particular words, and I have removed pico from the description as it had no relevance. – Tom Scott Nov 23 '16 at 15:11
  • 1
    cat is not grep – Ipor Sircer Nov 23 '16 at 15:14
  • Yes thank you for clearing that up @Ipor Sircer the question is can I use cat to do it? – Tom Scott Nov 23 '16 at 15:15
  • Well... cat stands for concatenate. "Cat" is a solution to the "highlight problem". May you just tell us, why you want to do this? May be highlight can be a solution. May be grep... – Tobias Nov 23 '16 at 15:16

The answer is, or should be: Not possible.

Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s) to standard output.

With no FILE, or when FILE is -, read standard input.

  -A, --show-all           equivalent to -vET
  -b, --number-nonblank    number nonempty output lines, overrides -n
  -e                       equivalent to -vE
  -E, --show-ends          display $ at end of each line
  -n, --number             number all output lines
  -s, --squeeze-blank      suppress repeated empty output lines
  -t                       equivalent to -vT
  -T, --show-tabs          display TAB characters as ^I
  -u                       (ignored)
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
      --help     display this help and exit
      --version  output version information and exit

  cat f - g  Output f's contents, then standard input, then g's contents.
  cat        Copy standard input to standard output.

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/cat>

The 'core' function of cat is to concatenate - literally. in other words - anything that does not concatenate - or link (things) together - should be considered superfluous

  • While your assignment might be to use 'cat' - the assignment is wrong. cat is a program with historical perspective. something such as cat * (for multiple files) | sed sed_argsORPrgs would be a more *nix approach imho – Michael Felt Nov 23 '16 at 15:32
  • Well, it is my GCSE so I'd hope that it can be done. – Tom Scott Nov 28 '16 at 11:44

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