Search Results

Search: Posts Made By: AlphaLexman
17,347
Posted By Chubler_XL
To convert bytes to human readable value: ...
To convert bytes to human readable value:

awk ' BEGIN { split("bytes,KB,MB,GB,TB,PB,EB,ZB,YB",SZ,",") } { p=1;for(i=0;$1/p>1024;i++) p*=1024; printf "%4.4f %s\n", $1/p, SZ[i+1]}'
5,155
Posted By rdcwayx
du -s *.pdf |awk '{sum+=$1}END{print sum}'
du -s *.pdf |awk '{sum+=$1}END{print sum}'
11,930
Posted By alister
That glob is expanded by the shell while parsing...
That glob is expanded by the shell while parsing the command, which happens before the function is called. For your expected result, quote the argument to the function and use an unquoted $1 in both...
1,867
Posted By alister
You could replace cut -d ":" -f 2with sed...
You could replace
cut -d ":" -f 2with
sed 's/[^:]*://; s/^ symbolic link to.*/ symbolic link/'In all cases, it removes everything up to the first colon, inclusive. In the case of symbolic link,...
2,139
Posted By Franklin52
To replace only the first occurrence you should...
To replace only the first occurrence you should omit the global option:
sed 's/AlphaLexman/ALM/'

instead of:
sed 's/AlphaLexman/ALM/g'
5,531
Posted By Scrutinizer
Hi, as you stated yourself in the first post this...
Hi, as you stated yourself in the first post this will not run in a script (COLUMNS will not be available there). You need to source it from a file:
. file
or run it directly in your interactive...
5,531
Posted By cfajohnson
w=$(( $COLUMNS / 2 - 20 )) cal | while IFS=...
w=$(( $COLUMNS / 2 - 20 ))
cal | while IFS= read -r line
do
printf "%${w}s %s\n" '' "$line"
done
Showing results 1 to 7 of 7

 
All times are GMT -4. The time now is 07:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy