03-29-2019
Welcome to the forum.
Please stick to the rules (e.g. use code tags), and be careful and consistent when presentig your problem (e.g. df -h in the title while df -BG in the post).
For your problem, none of the two, be it df -h or df -BG, is the option of choice, as the results displayed may suffer from improper rounding effects, and you always ask yourself are those units for 2^30 or 1E9 multipliers. Use blocks or bytes instead, and calculate to taste.
To remove the G character, use awk's sub() function for every field that it applies to, e.g. sub (/G/, "", $3).
If using df -B1, try int($3/2^30+.5)
Last edited by RudiC; 03-29-2019 at 09:12 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
im a new student in programming and im stuck on this question so please please HELP ME. thanks.
the question is this:
enter a command to delete all files that have filenames starting with labtest, except labtest itself (delete all files startign with 'labtest' followed by one or more... (2 Replies)
Discussion started by: soccerball
2 Replies
2. UNIX for Dummies Questions & Answers
Hi!!..
I would like to know what is maximum character size for a command in the "sh" or "bourne" shell?
Thanks in advance..
Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies
3. UNIX for Advanced & Expert Users
Hi!!..
I would like to know what is maximum character size for a command in the "sh" or "bourne" shell?
Thanks in advance..
Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies
4. Shell Programming and Scripting
Hi!!..
I would like to know what is maximum character size for a command in the "sh" or "bourne" shell?
Thanks in advance..
Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies
5. Shell Programming and Scripting
I wrote a script to delete files which are older than "x" days, if the size of the directory is greater than "y"
#!/bin/bash
du -hs $1
while read SIZE ENTRY
do
if ;
then
find $1 -mtime +$2 -exec rm -f {} \;
echo "Files older than $2 days deleted"
else
echo "free Space available"... (4 Replies)
Discussion started by: JamesCarter
4 Replies
6. Shell Programming and Scripting
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Discussion started by: shis100
7 Replies
7. Shell Programming and Scripting
Hello everyone
Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried
sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies
8. Shell Programming and Scripting
Hello,
I have file that looks like this :
765327564:line1
94:line2
7865:line3
.....
765322:linen
I want to cut all the digits from the beginning of each line up to ":" character and to have everything like this :
line1
line2
line3
.....
linen
P.S : content of line1 ...... (8 Replies)
Discussion started by: black_fender
8 Replies
9. Shell Programming and Scripting
find "*.c" and "Makefile" and then delete them with one line (3 Replies)
Discussion started by: yanglei_fage
3 Replies
10. Shell Programming and Scripting
Dear Ladies & Gents,
I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out:
for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies
MKFS(8) System Manager's Manual MKFS(8)
NAME
mkfs - construct a file system
SYNOPSIS
/sbin/mkfs [ -i bytes ] [ -s size ] [ -m gap ] [ -n modulus ] special
DESCRIPTION
N.B.: file systems are normally created with the newfs(8) command.
Mkfs constructs a file system by writing on the special file special. The size of the filesystem in logical blocks is specified by the -s
size option. Logical blocks are 1K (2 sectors) under 2.11BSD.
NOTE: The newfs(8) program's -s option is in units of sectors. Newfs(8) converts this to filesystem (logical) blocks for mkfs(8).
The number of inodes is calculated based on the argument bytes to the -i option. The default is 4096. If more inodes are desired in a
filesystem (there is an absolute maximum of 65500) then a lower value for bytes should be used, perhaps 3072 or even 2048.
The flags -m gap and -n modulus determine the block interleaving of the freelist that will be constructed, where gap is the distance
between successive 1024-byte blocks, and modulus is the number of blocks before the pattern repeats, typically one cylinder. The optimal
values for these parameters vary with the speed and geometry of the disk, as well as the speed of the processor. Newfs(8) will calculate
the correct values in almost all cases from the disklabel.
SEE ALSO
fs(5), dir(5), disklabel(8), fsck(8), mkproto(8) newfs(8)
BUGS
The lost+found directory is created but the boot block is left uninitialized (see disklabel(8).)
3rd Berkeley Distribution November 16, 1996 MKFS(8)