Tagged Questions
3
votes
2answers
56 views
Can I make grep treat escaped multiline as a single line?
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
...
3
votes
3answers
3k views
How can I pass strings with single quotes to grep?
My desired outcome is the following: to recursively search a directory looking for a given string in all found files. The following command is my usual port of call:
find ./ | xargs grep -ns 'foobar'
...
2
votes
1answer
515 views
Escaping of meta characters in basic/extended posix regex strings in grep
Is it possible to escape all meta characters of a string inside a variable before passing it to grep? I know similar question has been asked before on SE
(here) and also a good explanation here, but I ...
4
votes
1answer
533 views
How can I match the page break character in a regular expression?
Nano calls it ^L, but of course, typing something like
$ grep -v "^\^L" file
doesn't work. Its unicode codepoint is 000C. How can I match it in a regular expression?