1843946 Members
3033 Online
110226 Solutions
New Discussion

About the script

 
SOLVED
Go to solution
peterchu
Super Advisor

About the script

sorry to answer this simple question , as I don't know how to use the shell script .
I got the below script , could help to find out what is TEMP ? thx.

TEMP =`awk -F= '/tmp$/ { print $2 }' /home/abc`'


#vi /home/abc
aa bb
cc dd
ee ff
gg hh
ii jj
1 REPLY 1
Muthukumar_5
Honored Contributor
Solution

Re: About the script

$TEMP variable will be NULL.

And more try to use as,
TEMP=`awk -F= '/tmp$/ { print $2 }' /home/abc`'

No space between TEMP and =

Your awk program and examples are not related.

Awk will try to break fields with separator as "=" and with pattern occurance of tmp at end so that it will give the second field.

For example:

hai=bye=tmp

echo "hai=bye=tmp" | awk -F= '/tmp$/ { print $2 }'

will print bye string there.


And more as like,

--- example ---
cat > /tmp/test

hai=bye=tmp
1=234=tmp
user=test=bye

TEMP=`awk -F= '/tmp$/ { print $2 }' /tmp/test`;echo $TEMP


Output:
bye 234

HTH.
+muthu+
Easy to suggest when don't know about the problem!