Print any
IP address talking on port 21 in coming or out going.
Change the port number to any port that needs to be matched.
netstat -na | perl -ne '/((\d{1,3}\.){4}21)/ && print ;'
#!/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