If I have a bash file with following content:
ls \
/tmp
Is there a way to grep this file and get
ls \
/tmp
instead of
ls \
?
Please notice that other behaviors of grep should remain same if input is a large file and has other match patterns.
Thanks!
Assuming you want to treat the final
\as a line continuation character, you can useawkto concatenate the lines:This removes the line continuation character and combines everything into one line, then prints the line if if matches the regex
ls.