I was wondering if it's possible to use the grep command to pick out a string that contains spaces and line breaks, e.g.:
Hello
I
am
here right now
I'm still very new to regexps and using the command line in general (this is my second day of learning this), so my attempt was this:
grep H[\s\S]*w <filename>
I thought that [\s\S] would give you any character, including spaces and line breaks (unlike .), but it didn't work.
I use the terminal on my Mac OS (not sure if that makes a difference).
-Poz
switches likegrep -Poz "H[\s\S]*w" infile
– αғsнιη May 10 '18 at 04:25