Creating and using ackrc

2022-04-02 1 min read Learning ack grep Fedora
ack is a fantastic replacement for grep and probably much more than grep. Here is what the dnf info has to say about ack 1 2 3 4 5 6 Name : ack Architecture : noarch Summary : Grep-like text finder URL : http://beyondgrep.com/ License : Artistic 2.0 Description : Ack is designed as a replacement for grep. And their websites says - Designed for programmers with large heterogeneous trees of source code, ack is written in portable Perl 5 and takes advantage of the power of Perl’s regular expressions. Continue reading

GREP_COLORS – change the colors in the GREP output.

2019-04-22 4 min read bash Linux
Today we will look at the variable GREP_COLORS. This variable determines the colour that is used with the grep command. You can look at the man page of the grep command to see what the various options mean. Here is the excerpt from the man command: GREP_COLORS Specifies the colors and other attributes used to highlight various parts of the output. Its value is a colon-separated list of capabilities that defaults to ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36 with the rv and ne boolean capabilities omitted (i. Continue reading

Get count of lines in scripts (shell)

2015-10-15 1 min read bash
If you have tried to get the count of lines in file, the you would know about “nl” or “wc -l”. But as you are aware these give you number of lines with other details as well and you need to post process the number to make sure that you have only number and nothing else. In such cases, it is useful to use the count feature of grep and here is a shorthand to get the count of lines in any shell script: Continue reading

Raspberry Pi automate certain tasks – script example

2014-03-10 2 min read Raspberry Pi
Now, if you have followed these : fetchmail ssmtp Then you already have a working system for sending and receiving mail. Now, you can set the mda in the fetmailrc to a script which can do few things for you. The script below will get a page and mail it to you, if you have the subject as “get” and send “wake on LAN” to desired PC if you have subject as “wol”. Continue reading

Apache server stats with small and useful bash script.

2013-11-29 3 min read bash Linux Uncategorized Wordpress
Just copy this script to your web-server cgi-bin directory and enjoy. The script with show the common errors like 404 Error, Internal Server Error and others. It will show the User agent distribution using simple commands like grep, uniq, awk and so on. You would need to change the tfile – which is temporary file and also the access.log path in the next line. Just re-direct the output to some file with html extenstion. Continue reading
Older posts