Tagged: linux

0

Chart of similar operations with sed and awk

Chart of similar operations with sed and awk ——————————————– string ====== sed “s/from/to/” awk ‘{sub(“from”,”to”); print}’ sed “s/from/to/g” awk ‘{gsub(“from”,”to”); print}’ sed “s/from/to/3” awk ‘{$0=gensub(“from”,”to”,3); print}’ regex ===== sed “s/reg.*$/_&_/” awk ‘{sub(/reg.*$/, “_&_”); print}’ sed “s/reg[ex]/YY/g” awk ‘{gsub(/reg[ex]/, “YY”); print}’...

0

awk one liners

HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008 Compiled by Eric Pement – eric [at] pement.org version 0.27 Latest version of this file (in English) is usually at: http://www.pement.org/awk/awk1line.txt This file will also be available in other languages: Chinese -...

0

awk one liners (old)

————————————————————————- HANDY ONE-LINERS FOR AWK (Unix stream editor) Apr. 17, 2001 compiled by Eric Pement <[email protected]> version 0.1 Latest version of this file is usually at: http://www.student.northpark.edu/pemente/awk/awk1line.txt USAGE: Unix: awk ‘/pattern/ {print “$1”}’ # standard Unix shells DOS/Win: awk ‘/pattern/...

0

Setting up password-less ssh across all nodes in a cluster

Pre-requisites User account for which passwordless ssh will be setup, should be present on all nodes Password of the account should be same across all nodes pdsh and ssh-copy-id commands should be available Prepare 2 files file_of_hosts.txt – containing all...

0

top command on linux

Usage Basic $ top View by process name # top -p $(pgrep -d’,’ <process name>) # sample below, top -p $(pgrep -d’,’ http) View by user top -u <user name>   Sort by mem # Inside top Shift+m View command...

0

AWK quick reference

Tips Original article Tips awk regex awk ‘/[0-9]+ /{print}’ file.txt   not beginning with an expression awk ‘!/^anexpression/{print}’ file.txt   containing x and not containing y awk ‘/x/ && !/y/’ file.txt   Mixing single and double quotes $ awk ‘BEGIN...

0

VI quick reference

Introduction vi  pronounced as ” vee eye ” is a unix editor available on almost all the unix  operating systems , solaris , bsd ,aix , hpux etc. This document is a quick reference to vi editor and will be...

0

Crontab quick reference

Crontab generators http://www.crontab-generator.org/ http://www.openjs.com/scripts/jslibrary/demos/crontab.php http://corntab.com/     Source: http://www.adminschoice.com/crontab-quick-reference Setting up cron jobs in Unix and Solaris cron is a unix, solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These...

0

Setting up tmux without root access

At times we want access to tmux and we are just stuck due to admin restrictions or root access. There are three important parts to setting up tmux, It is dependent on libevent Compiling and installing on non-system folders require customized...

0

SSH Keep connection alive

Add below lines to file ~/.ssh/config Host * ServerAliveCountMax 3 ServerAliveInterval 10 TCPKeepAlive yes The first line specifies that this applies to all hosts The second and third specify that SSH2 keepalive messages should be sent every 10 seconds during...