Hi,
I'm trying to use an old script I found of the internet a while back, I forget where its from. Its supposed to convert the bdf function and display filesystem size in MB's and line it up however it never worked...
Here is the error:
./bdf.sh
Filesystem Mbytes used avail %used Mounted on
syntax error The source line is 2.
The error context is
{ printf("%s %10d %10d %10d %4s %s\n",$1,$2/1 >>>
<<<
awk: The statement cannot be correctly parsed.
The source line is 2.
And here is the code:
#!/usr/bin/sh
echo "Filesystem Mbytes used avail %used Mounted on"
bdf $1 | grep -v Filesystem | awk '{ printf("%s %10d %10d %10d %4s %s\n",$1,$2/1
024,$3/1024,$4/1024,$5,$6)}'
Can someone help me make sense of this?
Thanks
The script is one line only.
If you copy and paste it, the result will be two lines.
Try this:
bdf $1 | grep -v Filesystem | awk '{ printf("%s %10d %10d %10d %4s %s\n",$1,$2/1024,$3/1024,$4/1024,$5,$6)}'
1 Like
Heh, thanks. I am a newb...
shell_life:
The script is one line only.
If you copy and paste it, the result will be two lines.
Try this:
bdf $1 | grep -v Filesystem | awk '{ printf("%s %10d %10d %10d %4s %s\n",$1,$2/1024,$3/1024,$4/1024,$5,$6)}'
Useless use of grep:
bdf $1 | awk '!/Filesystem/{ printf("%s %10d %10d %10d %4s %s\n",$1,$2/1024,$3/1024,$4/1024,$5,$6)}'