mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
removed escapes on % for gawk
This commit is contained in:
parent
46c5bdf01c
commit
4d20c9fe84
16
inxi
16
inxi
|
@ -3503,18 +3503,18 @@ get_hdd_data_basic()
|
||||||
# this handles the case where the first item is too long
|
# this handles the case where the first item is too long
|
||||||
# and makes df wrap output to next line, so here we advance
|
# and makes df wrap output to next line, so here we advance
|
||||||
# it to the next line for that single case
|
# it to the next line for that single case
|
||||||
if ( NF < 5 && $0 !~ /.*\%/ ) {
|
if ( NF < 5 && $0 !~ /.*%/ ) {
|
||||||
getline
|
getline
|
||||||
}
|
}
|
||||||
# if the first item caused a wrap, use one less than standard
|
# if the first item caused a wrap, use one less than standard
|
||||||
# testing for the field with % in it, ie: 34%, then go down from there
|
# testing for the field with % in it, ie: 34%, then go down from there
|
||||||
# this also protects against cases where the mount point has a space in the
|
# this also protects against cases where the mount point has a space in the
|
||||||
# file name, thus breaking going down from $NF directly.
|
# file name, thus breaking going down from $NF directly.
|
||||||
if ( $4 ~ /.*\%/ ) {
|
if ( $4 ~ /.*%/ ) {
|
||||||
used += $2
|
used += $2
|
||||||
}
|
}
|
||||||
# otherwise use standard
|
# otherwise use standard
|
||||||
else if ( $5 ~ /.*\%/ ) {
|
else if ( $5 ~ /.*%/ ) {
|
||||||
used += $3
|
used += $3
|
||||||
}
|
}
|
||||||
# and if this is not detected, give up, we need user data to debug
|
# and if this is not detected, give up, we need user data to debug
|
||||||
|
@ -4211,7 +4211,7 @@ get_partition_data()
|
||||||
# this is required because below we are subtracting from NF, so it has to be > 5
|
# this is required because below we are subtracting from NF, so it has to be > 5
|
||||||
# the real issue is long file system names that force the wrap of df output: //fileserver/main
|
# the real issue is long file system names that force the wrap of df output: //fileserver/main
|
||||||
# but we still need to handle more dynamically long space containing file names, but later.
|
# but we still need to handle more dynamically long space containing file names, but later.
|
||||||
( NF < 6 ) && ( $0 !~ /[0-9]+\%/ ) {
|
( NF < 6 ) && ( $0 !~ /[0-9]+%/ ) {
|
||||||
# set the dev location here for cases of wrapped output
|
# set the dev location here for cases of wrapped output
|
||||||
if ( NF == 1 ){
|
if ( NF == 1 ){
|
||||||
devBase=gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 )
|
devBase=gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 )
|
||||||
|
@ -4233,14 +4233,14 @@ get_partition_data()
|
||||||
# this is to avoid file systems with spaces in their names, that will make
|
# this is to avoid file systems with spaces in their names, that will make
|
||||||
# the test show the wrong data in each of the fields, if no x%, then do not use
|
# the test show the wrong data in each of the fields, if no x%, then do not use
|
||||||
# using 3 cases, first default, standard, 2nd, 3rd, handles one and two spaces in name
|
# using 3 cases, first default, standard, 2nd, 3rd, handles one and two spaces in name
|
||||||
if ( $(NF - 1) ~ /[0-9]+\%/ ) {
|
if ( $(NF - 1) ~ /[0-9]+%/ ) {
|
||||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary," $(NF - 5) "," devBase
|
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary," $(NF - 5) "," devBase
|
||||||
}
|
}
|
||||||
# these two cases construct the space containing name
|
# these two cases construct the space containing name
|
||||||
else if ( $(NF - 2) ~ /[0-9]+\%/ ) {
|
else if ( $(NF - 2) ~ /[0-9]+%/ ) {
|
||||||
print $(NF - 1) " " $NF "," $(NF - 5) "," $(NF - 4) "," $(NF - 2) ",secondary," $(NF - 6) "," devBase
|
print $(NF - 1) " " $NF "," $(NF - 5) "," $(NF - 4) "," $(NF - 2) ",secondary," $(NF - 6) "," devBase
|
||||||
}
|
}
|
||||||
else if ( $(NF - 3) ~ /[0-9]+\%/ ) {
|
else if ( $(NF - 3) ~ /[0-9]+%/ ) {
|
||||||
print $(NF - 2) " " $(NF - 1) " " $NF "," $(NF - 6) "," $(NF - 5) "," $(NF - 3) ",secondary," $(NF - 7) "," devBase
|
print $(NF - 2) " " $(NF - 1) " " $NF "," $(NF - 6) "," $(NF - 5) "," $(NF - 3) ",secondary," $(NF - 7) "," devBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4258,7 +4258,7 @@ get_partition_data()
|
||||||
devBase = gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 )
|
devBase = gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 )
|
||||||
used = sprintf( "%.2f", $4*1024/1000**3 )
|
used = sprintf( "%.2f", $4*1024/1000**3 )
|
||||||
percentUsed = sprintf( "%.0f", ( $4/$3 )*100 )
|
percentUsed = sprintf( "%.0f", ( $4/$3 )*100 )
|
||||||
print "swap-" swapCounter "," size "GB," used "GB," percentUsed "\%,main," "swap," devBase
|
print "swap-" swapCounter "," size "GB," used "GB," percentUsed "%,main," "swap," devBase
|
||||||
swapCounter = ++swapCounter
|
swapCounter = ++swapCounter
|
||||||
}' ) )
|
}' ) )
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
|
|
Loading…
Reference in a new issue