simple awk script question
hello all
while i was reading in the bash beginners guide in the awk section i found this script that prints the critical partitions Code:
df -h | sort -rnk 5 | head -3 | \awk '{ print "Partition " $6 "\t: " $5 " full!" }' thanks |
sort -rnk 5
is equivalent to sort -r -n -k 5 * -k 5 means sort by the 5th field (column) * -n means numerical sort . Take 4,74,8,99 A non numerical will sort like this: 4 74 8 99 A numerical one will sort like this: 4 8 74 99 * -r means reverse A numerical reversed : 99 74 8 4 head -3 will print the first three line of the input In this case, it will print the 3 biggest values: 99 74 8 |
thanks for you help :)
and i want to know what is the use of "\" backward slash and "/" forward slash inside the awk command ? . |
Quote:
D. |
The \ at the start of the awk command makes the shell ignore any aliases set on the awk command, and forces it to use the version of awk found in the PATH variable. This way, when writing shell scripts, you can be sure that the command you indend to run is that which is executed. This is often used in conjunction with rm to make sure files get deleted:
Code:
\rm -f files |
I would highly recommend downloading the coreutils manual from the GNU website. The coreutils package contains many of the most common programs and their options.
http://www.gnu.org/software/coreutil.../coreutils.pdf |
many thanks for all\\
the df command just print the partitions like 1.)mounted patitions and 2.) the / partitions if i want to make the script reads the whole file system like /etc /var /opt ..... any ideas and thanks again |
Quote:
|
This will show you percentage of use of each mounted filesystem.
Code:
mount | grep '^/dev/' | cut -d' ' -f1 | xargs df |
Thanks Guru
|
All times are GMT -5. The time now is 10:09 AM. |