Tag Info

New answers tagged

0

If the text is not too big you can flatten the string by replacing all the newline characters with some safe special token - then perform normal sed operations on it and explode the tokens back to newlines when you are done.


1

Actually, there is a utility that does exactly this. I know cos it was me wot wrote it. It was written for *BSD but ought to compile on Linux if you have the BSD libraries (which I believe are common). I've just released a new version, posted here: http://blog.frankleonhardt.com/2015/freebsd-hr-utility-human-readable-number-filter-man-page/ It's called ...


-1

The answer to your question is yes. While the output format isn't exactly to your specification, the conversion itself is easily done by a very standard tool (or two). The ones to which I refer are dc and bc. You can get a segmented report by altering their output radices. Like this: { echo 1024 o #set dc's output radix echo 1023 pc ...


0

Recursified version of Gilles Awk solution (from above): awk 'function human(x) { x[1]/=1024; if (x[1]>=1000) { x[2]++; human(x); } } {a[1]=$1; a[2]=0; human(a); print a[1],substr("kMGTEPYZ",a[2]+1,1)}'


1

You can also try http://dl.getipaddr.net They use curl (which is a well known command line utility) to run a speed test. The code is published on GitHub as well. In short, wget https://raw.github.com/blackdotsh/curl-speedtest/master/speedtest.sh && chmod u+x speedtest.sh && bash speedtest.sh


1

In man bash we can read in Shell Builtin Commands section: Unless otherwise noted, each builtin command documented in this section as accepting options preceded by - accepts -- to signify the end of the options. The :, true, false, and test builtins do not accept options and do not treat -- specially. The exit, logout, break, continue, let, and ...



Top 50 recent answers are included