Executing grep in perl always returns and empty string -


when run grep command line in centos 5.8 using following command get

grep -e "appliance=\"vpmx\"" /filepath/appliance_data.sh 

with results of

appliance="vpmx"; export appliance 

when run following commands perl

$out = `grep -e "appliance=\"vpmx\"" /filepath/appliance_data.sh`; `echo "output grep tv: $out" >> /tmp/debug`; 

the $out variable empty string

how same output command line grep?

i have tried quiet grep using -q parameter, , have tried command < /dev/null no change in result.

you need escape backslashes backticks work double quoted string default:

$out = `grep -e "appliance=\\"vpmx\\"" /filepath/appliance_data.sh`; 

alternatively, single quoted form of qx:

$out = qx'grep -e "appliance=\"vpmx\"" /filepath/appliance_data.sh'; 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -