That's the issue. More appropriately idiomatic awk:
df -k | awk 'NR > 1 && $5 >= 39 { print $5, $1, $6 }'
Note that we're skipping the header line (NR>1) and forcing the comparison
to be numeric. Finally, on the output you can just separate items with
commas and it'll use the output FS to separate them. With some awks you
can separately set the OFS. In that case you can do something like this:
awk -v OFS="\t" ...
For what you're doing, though, putting "\t" in between does the same thing,
obviously, but sometimes it's more readable to do it this way.
Michael
On Thu, Jun 20, 2013 at 9:10 AM, Blake Dunlap <[email protected]> wrote:
> is that actually doing a numerical comparison, or is it just character
> comparison?
>
> If its just character comparison, the 4 is > than the 3...
>
>
> On Thu, Jun 20, 2013 at 9:05 AM, Jack Coats <[email protected]> wrote:
>
>> I am trying to put in a quick script to find the oversized file
>> systems. Just testing, I am getting a spurious line in the output and
>> can't figure out how.
>> Here is my console info:
>>
>> jack@nomad2:~$ df -k
>> Filesystem 1K-blocks
>> Used Available Use% Mounted on
>> rootfs 14418416
>> 5194680 8491320 38% /
>> udev 10240
>> 0 10240 0% /dev
>> tmpfs 399676
>> 884 398792 1% /run
>> /dev/disk/by-uuid/9b5db92c-8501-4ea4-bf5d-7270b644a899 14418416
>> 5194680 8491320 38% /
>> tmpfs 5120
>> 0 5120 0% /run/lock
>> tmpfs 2073500
>> 1596 2071904 1% /run/shm
>> /dev/sda1 282599
>> 2062 265945 1% /boot
>> /dev/sda5 18089460
>> 665132 16505412 4% /var
>> /dev/sda6 76304160
>> 52798332 19629748 73% /home
>> /dev/sdb1 488385556
>> 152106420 336279136 32% /media/G500
>> jack@nomad2:~$ df -k|awk '{if ( $5 >= "39%" ) print $5," ",$1,"
>> ",$6 }'
>> Use% Filesystem Mounted
>> 4% /dev/sda5 /var
>> 73% /dev/sda6 /home
>> jack@nomad2:~$
>>
>> Why the /var line in the output?
>> Suggestions?
>>
>> BTW, to get the tab in the output line, in the literal enter a CNTL-v
>> then press the tab character. It looks like the tab didn't translate
>> well in the second 'space' entry between the $1 and the $6
>>
>> ><> ... Jack
>> --
>> Whatever you do, work at it with all your heart... Colossians 3:23
>> "If you are not part of the solution, you are part of the precipitate"
>> - Henry J. Tillman
>> "Anyone who has never made a mistake, has never tried anything new." -
>> Albert Einstein
>> "You don't manage people; you manage things. You lead people." -
>> Admiral Grace Hopper, USN
>> Life is complex: it has a real part and an imaginary part. - Martin Terma
>> “Our virtues and our failings are inseparable, like force and matter.
>> When they separate, man is no more.” - Nikola Tesla
>> I don't enjoy a massacre of ads. Hackaday.com says this should
>> slaughter their existance.
>>
>> --
>> --
>> You received this message because you are subscribed to the Google Groups
>> "NLUG" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nlug-talk?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "NLUG" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
> --
> --
> You received this message because you are subscribed to the Google Groups
> "NLUG" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nlug-talk?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "NLUG" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
Michael Darrin Chaney, Sr.
[email protected]
http://www.michaelchaney.com/
--
--
You received this message because you are subscribed to the Google Groups
"NLUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nlug-talk?hl=en
---
You received this message because you are subscribed to the Google Groups
"NLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.