21 Jan 2010 11:58
using awk on a variable
Hello,
I have the following code which is not working -
ReturnValue="`ls -als "$Package"`"
if [[ "$ReturnValue" != "" ]]
then
DateTime="`awk "$ReturnValue" { print $7, $8 }`"
echo "$DateTime"
return
fi
The error returned is as follows -
awk: 592 -rwxr-xr-x 1 root root 601056 2009-01-29 04:51 gedit
awk:
^ syntax error
I imagine that somehow I am passing the variable to awk incorrectly. I
need the 7th, and 8th arguments of the string
variable $ReturnValue, and it will contain the string shown in the error
message above.
Can someone please enlighten me as to the proper way of doing this?
Thanks, Ray Parrish
RSS Feed