23.11.2011

graphic without perl


# for i in 2 12 56 2 4; do x=1; while [ $x -le $i ];do echo -n .;x=$(( $x + 1 )) ;done; echo ; done  
..
............
........................................................
..
....

simple graphic

for i in 2 12 56 2 4; do echo $i|perl -e 'while (<>) { print "."x $_ . "\n"; }'; done

..
............
........................................................
..
....

Sort on multiple fields


$ cat quota
 bob 1000
 an 1000
 chad 1000
 don 1500
 eric 5000
 fred 2000

 $ sort -k2n,2 -k1,1 quota
 an 1000
 bob 1000
 chad 1000
 don 1500
 fred 2000
 eric 5000

cisco acces-list filter

grep denied cisco_security.log |grep 2082|grep 192.168.192.11 |awk '{print $18}'|sed 's/(.*//g'|sort|uniq -c|sort -g   

one linersync a slave that is facing duplicate entry errors.

while [ 1 ]; do if [ `mysql -u root -e "show slave status \G;" | grep "Duplicate entry" | wc -l` -eq 1 ] ; then mysql -u root -e “stop slave; set global sql_slave_skip_counter=1; start slave;”; fi; sleep 1; mysql -u root -e “show slave status\G”; done

22.11.2011

сложение HEX в BASH

echo $((0x8B4513 + 0x1))|xargs printf "%X\n"