How can I make tools like grep
treat multilines escaped with a backslash as a long single line?
Let's say I have some files that looks like this:
testvar=test1 \
test2 \
test3
othervar=oth1 \
oth2
If I now grep
for testvar it will return testvar=test1 \
,
but is there any way I can have it return testvar=test1 test2 test3
?
More or less how to treat those multiple escaped lines as a single line?
Note: If this can't be done with grep
, hints about how to do this with other tools like sed
or awk
to get the same result are also welcome.