Search code examples
regexgreppcrepcregrep

grep and return line continuations?


I want grep to return results through line continuations, ie input file like:

$ cat input.txt
abba \
  jjjj \
  nnnn

$ grep "abba ?" input.txt
abba jjjj nnnn

I can't seem to get it working.


Solution

  • Maybe you are looking for something like this where you search in your file after replacing slashes with newlines...

    tr '\\' '\n' < input.txt | grep something