Hi All
I have a file containing following records:
$HEW_TGT_DB2_USER=hbme_bi2
$prmAttunityUser=ais
$DS_USER=hbme_bi2
$prmStgUser=hbme_bi2
$prmuser=hbme_bi2
$prmStgPass=hbme_bi2
$prmpwd=hbme_bi2
$prmAttunityUser=ais
Say suppose the name of the file is test4.txt
When i fire this command on linux
ret=`grep \^$prmAttunityUser\= test4.txt`
echo $ret
The value in "ret" is blank could you all please help me in troubleshooting this where as i want that "ret" variable should contain output like this
$prmAttunityUser=ais
Thanks
jville
2
#ret=$(grep '$prmAttunityUser\=' test4.txt )
#echo $ret
#$prmAttunityUser=ais $prmAttunityUser=ais
ret=$(grep \$prmpwd <file name>)
You need to escape $
1 Like
I want the output as
prmAttunityUser=ais
The output should be excluding the $ sign.
if you want something like
$DS_USER should be hbme_bi2
$prmAttunityUser should be ais
then you need to read about the command source or ( . )
$ cat test.txt
a=one
b=two
c=three
$ . test.txt
$ echo $a
one
$ echo $b
two
$ echo $c
three
Similar post : Grep issue
Please continue with the link ..