insert a dot in between a number string
Input
146870984704 1166734995456 3956629118976 75278372864 Output 146.870984704 1166.734995456 3956.629118976 75.278372864 Have to insert a dot after 9th position from last character. OR Is there a way to convert bytes to GB format |
where is this list from? commands like df or du have switches to display result in GB format.
from the other hand you can use sed/awk/perl/python/whatever to do that. Which one do you prefer? |
Need the disk space usage details on all the drives of a windows box from unix command line
The command which i have used displays in bytes, need it in GB WMIC LOGICALDISK GET Name,Size,FreeSpace,FileSystem Caption FileSystem FreeSpace Size C: NTFS 146870984704 179980595200 D: NTFS 1166734995456 1319847849984 F: NTFS 3956629118976 22430185676800 G: NTFS 75278372864 900015845376 |
Grab your favourite language and divide by either 1000 or 1024 until you get your required result. You can do it the way you wish as well with simple text manipulation.
|
10.1. Manipulating Strings
Advanced Bash-Scripting Guide you forgot to say which language you need to do this in. |
Member Response
Quote:
Code:
df -h |
It seems you have these values as strings (originally extracted from a MSWin system), so 3 options:
As above, if you can mount them from a Linux box, then 'df -h'. If not, string manipulation using 'rev' eg Code:
echo 12345|rev You're probably better to calc it as per grail. |
All times are GMT -5. The time now is 07:37 PM. |