4 ms·
Using grep with strings that span multiple lines is not a big deal. Use the -A and -B flags, as well as --with-filename. Widely agreed-on code standards do ex
by cmccabe 13y ago
Using grep with strings that span multiple lines is not a big deal. Use the -A and -B flags, as well as --with-filename.
Widely agreed-on code standards do exist. Usually they are either 80 or 100 characters per line.
- viraptor 13y agoThis is not always true: log.msg("error with " + "some description") grep "error with some description" ... Yes, there are standards for coding. They are usually 80 or 100 characters. And each one has a different way of handling the wrapping cases, splitting strings, wrapping values (parens, line join with \, concatenation, etc.)
- cmccabe 13y agoYou can use something like this: grep --with-filename -A 3 error $FILES | grep -C 3 description If that's not elegant enough for you, there are even tools like pcregrep that can do multiline matches. Don't uglify the code because of easily solved tool problems.