Find the answer to your Linux question:
Results 1 to 4 of 4
Iam working on Free BSD 5.3 version. U all know that the output of 'df' command looks as follows: Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad0s1a 253678 59116 174268 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2006
    Posts
    4

    help this poor guy please!


    Iam working on Free BSD 5.3 version. U all know that the output of 'df' command looks as follows:

    Filesystem 1K-blocks Used Avail Capacity Mounted on
    /dev/ad0s1a 253678 59116 174268 25% /
    devfs 1 1 0 100% /dev
    /dev/ad0s1e 253678 24280 209104 10% /tmp
    /dev/ad0s1f 8913022 2615376 5584606 32% /usr
    /dev/ad0s1d 253678 30246 203138 13% /var
    devfs 1 1 0 100% /var/named/dev


    Now i want to check which partition if greater than 90% full without scanning the first row of record. How to do this using awk command? PLease anyone of u help me with this?

  2. #2
    Linux User muha's Avatar
    Join Date
    Jan 2006
    Posts
    290
    depending on what you are trying to do:
    df |sed '1d'|awk '{if ($5 > 90) print $5,$6}'|sort -r
    99% /harddisk/C
    96% /harddisk/E

    df |sed '1d'|awk '{if ($5 > 90) print $6}'|sort -r
    /harddisk/C
    /harddisk/E

    or unsorted:
    df |sed '1d'|awk '{if ($5 > 90) print $5,$6}'
    96% /harddisk/E
    99% /harddisk/C

    /edit: df |sed '1d'| awk '$5 > 90 {print $5,$6}'
    also works ..

  3. #3
    Linux Guru bryansmith's Avatar
    Join Date
    Nov 2004
    Location
    /Ontario/Canada
    Posts
    2,619
    Does this have anything to do with your homework sounding question?

    Bryan
    Looking for a distro? Look here.
    "There can be no doubt that all our knowledge begins with experience." - Immanuel Kant (Critique of Pure Reason)
    Queen's University - Arts and Science 2008 (Sociology)
    Registered Linux User #386147.

  4. #4
    Just Joined!
    Join Date
    Feb 2006
    Posts
    4
    Its not working Muha, i have tried urs but is not working.

    And actually i have to compare the 5th field with greater than 90% from the output o fthe df command. So give me a clue to accept this % symbol.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •