using awk on a variable

Ray Parrish crp at cmc.net
Thu Jan 21 13:46:49 UTC 2010


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

-- 
Linux dpkg Software Report script set..
http://www.rayslinks.com/LinuxdpkgSoftwareReport.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com






More information about the ubuntu-users mailing list