Arun, if you want to match the eaxct string , you can use the /^<to match>$/ of awk:
for eaxmple:
Code:
s='abc.properties abc Scanner directory: /xyz/xzky/'
Code:
echo $s |awk '/^abc.properties abc Scanner directory: \/xyz\/xzky\/$/'
This will return if string is there.
but
Code:
s='spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no -o ServerAliveInterval=600 -o ServerAliveCountMax=3 -o ConnectTimeout=30 xyz@123.abc.com Password: Creating directory '/home/xyz'. Authorized uses only. All activity may be monitored and reported. Successful login using -u option. If you want to allow X traffic please use -x option. Usage: /111/11/111/111 [policy] -x [target user] su from xyz to abc [abc@xyz ~]$ /111/111/111/111/111/111.sh /111/11/instance/111/111/111/111/ Verifying JVM setting for domain: /111/11/11/11/1111/111/111// abc.properties abc Scanner directory: /xyz/xzy/ [abc@xyz ~]$ exit 0 logout'
Code:
echo $s |awk '/^abc.properties abc Scanner directory: \/xyz\/xzky\/$/'
will not return anything.