unix - grep command not match start of new line with another regex -
i have file content:
path=/nfs/location/alex path = /nfs/location/ alex/nfs/location /nfs/location/ # /nfs/location/ #alex /nfs/location alex # d /nfs/location /nfs/location
i want print line path starts , don't contain #
/nfs/location/
in example line 3 not match
i wrote unix commad:
grep -re ([^#.*]|^[^0-9aa-zz]/nfs/location/ .
but lines # appear
you want select lines /nfs/location
additional requirement:
should on start of line or non-alnum character must in front of it. can use or in expression:
echo "path=/nfs/location/alex path = /nfs/location/ alex/nfs/location /nfs/location/" | grep -e "(^|[^0-9a-za-z])/nfs/location"
Comments
Post a Comment