1
If I run a command like:
watch "ps -ef | grep '^foo.*bar'"
and the matching output line of ps -ef
is a long line like
foo <lots and lots of text here> bar
whether this line is output is affected by the terminal size. For example, if the terminal is full screen and this line fits on the screen, then the output will be shown in watch. However, if I resize the window to half the screen size so that the bar is truncated from the screen, then the grep line entirely disappears (presumably the line is truncated before it gets to grep in the pipeline). This is a problem because I'm trying to extract a portion of this line for use later in the pipeline.
Is there any solution to this to prevent the terminal size from affecting the output of grep within a watch command?