How to grep sideways

‘grep’ping for a word in a giant one line file is tough, here’s how to do it:

grep -E -o “StringToFind.{1,150}” /path/to/file.php

and then stack other grep’s if needed

like getting a service user for instance0:

su – `ps -ef|grep ance0 |grep -E -o “u01.{1,20}”|cut -f 2 -d \/|sort|uniq`

Leave a Reply

Your email address will not be published. Required fields are marked *