one liner needed

Hi

I have a file say (a.txt) which has following

a.txt
----

$$var1=Tom
$$var2=Kim

I need a one liner which searches the file(a.txt) for $$var1 and returns the value in it(Tom).

Thanks in advance
Ammu

AWK -F = '/\$\$var1/ {print $2}' /tmp/a.txt

Substitute AWK with nawk or gawk or awk depending on the OS used.

sed:

sed -n 's/\$\$var1=//p' a.txt
perl -wln -e 'print $1 if /^.*\=(.+)$/' a.txt

Thanks for quick reply.
It is failing with below error

awk: syntax error near line 1
awk: bailing out near line 1

Strange:

$ awk -F= '/\$\$var1/{print $2}' a.txt
Tom

Hello ,

gaurav@localhost:~$ cat > a.txt
var1=tom
var2=kim
gaurav@localhost:~$ perl -wl -e 'open(FILE,"<a.txt");my $var=<STDIN>;chomp $var;while(<FILE>){print $1 if /^$var=(.+)/}'
var1
tom

This will take the name as input like var1 and give "tom"
Hope this is what you exactly want.
Regards.

Use nawk (new/standard awk), not awk (old/obsolete awk) on Solaris.