cool sed/grep magic to convert output to csv format

2019-03-11 1 min read Bash Learning

I generallly keep doing this a lot, so thought will share with you. Lets assume we are capturing free ouput every min/hour/or whatever. The output looks like this:

Time: Mon Jan 21 23:59:10 AEDT 2019
——————-

total        used        free      shared  buff/cache   available
Mem:          32014        8656        1735        1697       21621       21308
Swap: 51195 75 51120

then we can use some grep and sed to convert this to something like this:

Mon Jan 21 23:59:10 AEDT 2019,32014,8656,1735,1697,21621,21308

Continue reading

speedtest cli

2015-01-30 1 min read Fedora

To test your speed you can use speetest-cli. Here is the description:

Command line interface for testing internet bandwidth using speedtest.net

and to install and test:

sudo yum install speedtest-cli

#Run
speedtest-cli

The output is like below:

[speetest-cli][1]
speedtest-cli

CLI Color and bash prompt.. some colored fun with prompts in bash

2010-06-29 5 min read Bash Fedora Linux

There are two ways to do it, one is with tput command. We will see that some other time, today we will consider the escape sequence way.

First we need to understand the colors as understood by bash. Some time back a fried of mine gave me this little script to find the colors. You can download it <a href="http://blog.amit-agarwal.co.in/2009/03/bash_colors" target="_blank">Script bash colors. Here is the script

#!/bin/bash

T=&#8217;amit agarwal&#8217;   # The test text

Continue reading

Upload a video to youtube

2010-06-23 1 min read Linux

<span style="font-size: x-large;"><a href="http://feedproxy.google.com/~r/Command-line-fu/~3/JXJj-wy4keA/upload-a-video-to-youtube">Upload a video to youtube

  <td>
    <div class="bash codecolorer">
      google youtube post <span class="re5">--title</span> <span class="st0">"My Video"</span> <span class="re5">--category</span> Education ~<span class="sy0">/</span>myvideo.avi<span class="sy0"></</span>tt<span class="sy0">><</span>tt<span class="sy0">></span>
    </div>
  </td>
</tr>
1

Google just released a new commend line tool offering all sorts of new services from the commend line. One of them is uploading a youtube video but there are plenty more google services to interact with.

Continue reading

concatenate compressed and uncompressed logs

2010-06-21 1 min read Bash Linux

<span style="font-size: x-large;"><a href="http://feedproxy.google.com/~r/Command-line-fu/~3/iwFUyltYgjM/concatenate-compressed-and-uncompressed-logs">concatenate compressed and uncompressed logs

$ find /var/log/apache2 -name 'access.loggz' -exec <a class="zem_slink freebase/en/gzip" title="Gzip" rel="homepage" href="http://www.gzip.org/">zcat {} ; -or -name 'access.log' -exec cat {} ; This command allows you to stream your log files, including gziped files, into one stream which can be piped to <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk or some other command for analysis.

Note: if your version of &#8217;find&#8217; supports it, use:

Continue reading

email with templates (with variables) from the command line with sendmail or any other MTA.

2010-06-09 2 min read Bash Fedora Linux

I was trying to get templates to work on evolution and found that although templates are there in evolution mail client, its not that efficient to use. What I thus wanted was to have something that could allow me to send mails to (and cc and bcc) to specified people with predefined template, only some values changed, like changelog and so on. So I wrote a set of files and below files to achieve the same. Hope it helps you too 🙂

Continue reading
Older posts