I am using egrep to look through scripts in our perforce NAS.
i am trying to find where we use RCP & RSH....The problem i have is that 1) I suck at REGEX; 2) i am picking up junk I am not interested in. For example if a file has the word strcpy..it picks up on RCP..or ownership..hits on RSH.
Obviously i am not interested in those, but I don't want to exclude lines based on the words ownership or strcpy...because they may be used in conjunction...and its not a complete list.
Here is my regex
'ftp|rcp|rsh'
How can mod these to hit on FTP, but not SFTP...rcp but no strcpy, rsh but not ownership.....etc.?
So Things I would want to match.
ftp
`ftp`
/ftp/
"PUNCT"FTP"PUNCT"
There are several metacharacters:
\b
word boundary\<
word start\>
word endSo, one possible regex is:
\<(ftp|rcp|rsh)\>
Maybe you need something like this:
\b
< - this is the border of word\bpattern\b
<- this pattern will match onlypattern
, but nototherbigpatternthatyounotneed