help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Graphing a list of values


From: hancooper
Subject: Graphing a list of values
Date: Sat, 18 Sep 2021 08:01:39 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, September 18, 2021 7:55 AM, Alex fxmbsw7 Ratchev 
<fxmbsw7@gmail.com> wrote:

> i posted awk code that does similiar
> you can extract $2 by a awk '{ print $2 }' before it, and not using ${t[*]} 
> for your data piped as input
>
> just curious, did you recieve a mail post with the awk code ?

Cannot see your code around, except the parts below

> let me actually fix up the code for your usage
>
> printf %s\ %s\\n @ 20 + 100 . 50 | awk '{ print $2 }' | gawk -v c=15 -v S=+ 
> '{ m = m < $1 ? $1 : m ; s[NR] = $1 } END { while ( ++i <= NR ) print l( int( 
> s[i] / m * c ) ) } function l( n, t ) { t = sprintf( "%-" n "s", "" ) ; gsub( 
> " ", S , t ) ; return t }'
>
> +++
> +++++++++++++++
> +++++++
>
> On Sat, Sep 18, 2021, 09:49 hancooper <hancooper@protonmail.com> wrote:
>
>> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>> On Saturday, September 18, 2021 5:46 AM, Alex fxmbsw7 Ratchev 
>> <fxmbsw7@gmail.com> wrote:
>>
>>> i used in the awk post i did the max of seen in data yes
>>
>> Somehow I got to pass the second field of each element in the array. Perhaps 
>> sed can help here.
>>
>>> On Sat, Sep 18, 2021, 07:46 hancooper <hancooper@protonmail.com> wrote:
>>>
>>>> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>>>> On Saturday, September 18, 2021 5:26 AM, Alex fxmbsw7 Ratchev 
>>>> <fxmbsw7@gmail.com> wrote:
>>>>
>>>>> you have a max_mb per maxcols too ?
>>>>>
>>>>> i wanted to give it a try but the max_mb is missing, for scaling right
>>>>>
>>>>> .. ?
>>>>
>>>> I can set a maximum (7200 is a sensible value), or use the maximum in the 
>>>> array.
>>>>
>>>>> On Sat, Sep 18, 2021, 06:09 hancooper via help-bash@gnu.org wrote:
>>>>>
>>>>> > I have an array composed of the following elements and want to generate 
>>>>> > a
>>>>> > graph of the values, distributed over a number of columns (ncols=80)
>>>>> >
>>>>> > + 3665.64686592 MB
>>>>> > + 1261.64520768 MB
>>>>> > + 96.35131584 MB
>>>>> > + 61.17171840 MB
>>>>> > + 99.81615072 MB
>>>>> > + 541.22517696 MB
>>>>> > + 1067.42695488 MB
>>>>> > + 462.11600448 MB
>>>>> > + 970.72017120 MB
>>>>> > + 1539.70699584 MB
>>>>> > + 2207.06856864 MB
>>>>> > + 2522.07166848 MB
>>>>> > + 645.12725472 MB
>>>>> > + 104.71848192 MB
>>>>> > + 70.59747552 MB
>>>>> > + 44.05066848 MB
>>>>> >
>>>>> >
>>>>> > For instance
>>>>> >
>>>>> > + 10 MB
>>>>> > + 50 MB
>>>>> > + 100 MB
>>>>> >
>>>>> >
>>>>> > Here would be the result with `ncols=10`
>>>>> >
>>>>> > *
>>>>> > *****
>>>>> > **********
>>>>> >
>>>>> >
>>>>> > Have started with the following, but have to modify to take values from 
>>>>> > an
>>>>> > array. Using `awk` seems as the better way to do this.
>>>>> >
>>>>> > oaggr=("+ 659.28737472 MB" "+ 316.94840736 MB" "+ 163.69489344 MB")
>>>>> > awk '{$2=sprintf("%-*s", $2, ""); gsub(" ", "=", $2); \\
>>>>> > printf("%-10s%s\\n", $1, $2)}' file
>>>>> >

reply via email to

[Prev in Thread] Current Thread [Next in Thread]