users@glassfish.java.net

How to assign awk output to a variable?

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Jul 2010 21:21:40 PDT

I just want the number of blocks, and I can get it with the following command in a bash shell on Solaris 10:
$4 is being interpolated and since it's undefined what's handed to the shell is:
my $outVar = `df | grep c0d0s3 | awk -F '{print}'`;

Just escape the $4:
my $outVar = `df | grep c0d0s3 | awk -F '{print \$4}'`;



____________________________________
[url=http://www.officechairsuk.com/acatalog/Herman_Miller_Products.html]Herman Miller[/url]|[url=http://www.officechairsuk.com/acatalog/Herman_Miller_Products.html] Herman Miller Chairs[/url]
[Message sent by forum member 'cena2020']

http://forums.java.net/jive/thread.jspa?messageID=477851