My lifehack for grepping over large files with huge lines
the trick is the second grep which will return 100 symbols before the match and 100 after. And the first grep because regexp-charged grep is significantly slower, so first we look for the lines contain the match and then take the excerpt with the match from these lines


Nice one with the 2nd part!! Im going to start to use that!
grep -rHin term | grep -iv ignoreterm | grep -v ignoreterm2 ...
Used still to this day,
recursive, show file name, show line number, ignore case,
yeah that one I got to use on a legacy project where, sadly, a lot of non critical errors are polluting the logs
I’ve always been partial to
grep -rnw ‘startingdir’ -e “phrase”
“grep renew” is also not too hard to remember. I’m trying to focus on mnemonics here so I can actually remember for those that don’t grep everyday
Members
Online

source

Categories: digitalSystemsTech