Shell Script

sed to play with data or parsing your text

To select all the lines starting from STARTING_PATTERN up to  blank line ^$ and then delete those lines. # sed ‘/STARTING_PATTERN/,/^$/d’ filename To edit files in place, use -i option. # sed -i ‘/STARTING_PATTER/,/^$/d’ filename Insert multiple lines into a file after specified pattern. # sed ‘/cdef/r add.txt’ input.txt # sed ‘/cdef/r add.txt’ input.txt input.txt:abcdaccdcdeflineweb …

sed to play with data or parsing your text Read More »

How to configure Proxy Settings for the Unix / Linux Console

You can use the following methods to configure your console to use a proxy server so that console based programs like wget could get connect to the internet through the proxy. 1 – Set the environment variable # export http_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/ # export ftp_proxy=http://DOMAIN\USERNAME:PASSWORD@SERVER:PORT/ In the above configuration you can ommit the DOMAIN\USERNAME:PASSWORD@ part if you …

How to configure Proxy Settings for the Unix / Linux Console Read More »

Delete Files Older Than x Days on Linux / Unix

The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We’ll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them. Command Syntax find /path/to/files* -mtime …

Delete Files Older Than x Days on Linux / Unix Read More »

How to check and install missing perl modules

Check if module is installed. Errors mean missing module. # perl -MModule::Name -e 1 See documentation of the module if installed. # perldoc Module::Name Open CPAN shell # perl -MCPAN -e shell To reconfigure the shell if needed. cpan>o conf init Install an available module. cpan> install HTML::Template You can run the Perl CPAN module …

How to check and install missing perl modules Read More »

Scroll to Top