How to remove empty or blank lines with awk.
Example 1:
command | awk '/^s*$/'
Example 2:
awk '/^s*$/' filename
How to remove empty or blank lines with awk.
Example 1:
command | awk '/^s*$/'
Example 2:
awk '/^s*$/' filename
When working across multiple platforms and flavours of IX, a system administrator might not always have tools like telnet or netcat available to test network connections. One tool that is on all flavours of IX and is universal is python.
A quick python script for testing network connection.
I used this python script to send a message via UDP to a logstash server.
Validating password with python.
Regex
import re
passRX = re.compile(r'[A-Za-z0-9@#$%^&+=]{8,}')
pp = passRX.search('dy_5mupV')
pp == None
True
pp = passRX.search('DEVGukvk')
pp == None
False
Example:
This will erase all checkID's with single and/or double digits.
:%s/"checkID":[0-9]\{1,2\} //g
Before
Running command.
#!/usr/bin/perl #------------------------------------------------------------------------- # Using getop #------------------------------------------------------------------------- use Getopt::Std; getopt('cw'); my @op = `./x.sh -c $opt_c -w $opt_w`; foreach (@op) { #printf "-c %s\t-w %s\n", $opt_c,$opt_w; print $_; }
my %options=();
#Pre set default values
my $critv=95; my $warnv=85; getopts("c:w:", \%options); $critv = $options{c} if defined $options{c}; $warnv = $options{w} if defined $options{w};
01201 095440 sd10 3393.2 1.1 13572.8 4.4 0.0 1.0 0.3 2 91
awk '{h=substr($2,1,2);\ m=substr($2,3,2);\ s=substr($2,5,2);\ $2=sprintf("%s:%s:%s",h,m,s);\ print $0;}' a.txt | head
101201 09:54:40 sd10 3393.2 1.1 13572.8 4.4 0.0 1.0 0.3 2 91
$ls -lat /current/*xml | \ nawk '{printf "%s ", $8; system("basename " $9)}'
for U in $(awk -F":" '{print $1}' passwd)
do
echo "________________ $U __________________"
UDIR=$(awk -F":" "/$U/"'{print $6}' passwd)
mkdir $UDIR
chown $U $UDIR
done
case ${NUMBER} in
[0-9]|[0-6][0-9]|7[0-5])
echo "${NUMBER} <= 75"
;;
[7-8][0-9]|9[0-5])
echo "75 < ${NUMBER}<=95"
;;
[9][5-9]|100)
echo "95< ${NUMBER} <=100"
;;
esac
$V="xNotEmpty" if [ x$V = "xNotEmpty" ] then echo "\$V not empty" else echo"\$V is empty" fi Or: if [ "$V" = "" ] then echo "\$V is empty fi
syntax on set viminfo^=h set ruler set nohls set incsearch set showmatch set ts=4 sw=4 syntax enable set hlsearch "Use F4 to switch high lighting on/off :noremap <F4> :set hlsearch! hlsearch<CR>