awk - Exact string match in multi line string -
i have string below, needed match if string "abc.properties abc scanner directory: /xyz/xzy/" present.
i using below awk command.
it considers successful if part of string, say, abc.properties present. but, criteria check exact string i.e. "abc.properties abc scanner directory: /xyz/xzy/".
can please help?
echo $s | awk 'begin { fs="\n"; rs="";} /abc.properties abc scanner directory: \/xyz/xzy\// {print $1}' string below:
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. activity may monitored , reported. successful login using -u option. if want allow x traffic please utilize -x option. usage: /111/11/111/111 [policy] -x [target user] su xyz abc [abc@xyz ~]$ /111/111/111/111/111/111.sh /111/11/instance/111/111/111/111/ verifying jvm setting domain: /111/11/11/11/1111/111/111// abc.properties abc scanner directory: /xyz/xzy/ [abc@xyz ~]$ exit 0 logout the output below:
$ echo $s | awk 'begin { fs="\n"; rs="";} /abc.properties abc scanner directory: \/xyz/xzy\// {print $1}' 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. activity may monitored , reported. successful login using -u option. if want allow x traffic please utilize -x option. usage: /111/11/111/111 [policy] -x [target user] su xyz abc [abc@xyz ~]$ /111/111/111/111/111/111.sh /111/11/instance/111/111/111/111/ verifying jvm setting domain: /111/11/11/11/1111/111/111// abc.properties abc scanner directory: /xyz/xzy/ [abc@xyz ~]$ exit 0 logout awk
No comments:
Post a Comment