
Terminal - Commands using gawk - 35 results
equery s | sed 's/(\|)/ /g' | sort -n -k 9 | gawk '{print $1" "$9/1048576"m"}'
This is sample output - yours may be different.
[email protected]:03:06:2:0:~> equery s | sed 's/(\|)/ /g' | sort -n -k 9 | gawk '{print $1" "$9/1048576"m"}'
app-text/scrollkeeper-9999-r1: 0m
gnome-base/gail-1000: 0m
--- *snip* ---
dev-java/sun-jdk-1.6.0.13: 158.84m
games-puzzle/neverball-1.5.0: 174.607m
app-office/openoffice-bin-3.0.0: 380.035m
On a Gentoo system, this command will tell you which packets you have installed and sort them by how much space they consume. Good for finding out space-hogs when tidying up disk space.
DD=`cat /etc/my.cnf | sed "s/#.*//g;" | grep datadir | tr '=' ' ' | gawk '{print $2;}'` && ( cd $DD ; find . -mindepth 2 | grep -v db\.opt | sed 's/\.\///g; s/\....$//g; s/\//./;' | sort | uniq | tr '/' '.' | gawk '{print "CHECK TABLE","`"$1"`",";";}' )
This is sample output - yours may be different.
CHECK TABLE `mysql.columns_priv` ;
CHECK TABLE `mysql.db` ;
CHECK TABLE `mysql.func` ;
CHECK TABLE `mysql.help_category` ;
CHECK TABLE `mysql.help_keyword` ;
CHECK TABLE `mysql.help_relation` ;
CHECK TABLE `mysql.help_topic` ;
CHECK TABLE `mysql.host` ;
CHECK TABLE `mysql.tables_priv` ;
CHECK TABLE `mysql.time_zone` ;
CHECK TABLE `mysql.time_zone_leap_second` ;
CHECK TABLE `mysql.time_zone_name` ;
CHECK TABLE `mysql.time_zone_transition` ;
CHECK TABLE `mysql.time_zone_transition_type` ;
CHECK TABLE `mysql.user` ;
CHECK TABLE `mysql.user_info` ;
This command will generate "CHECK TABLE `db_name.table_name` ;" statements for all tables present in databases on a MySQL server, which can be piped into the mysql command. (Can also be altered to perform OPTIMIZE and REPAIR functions.)
Tested on MySQL 4.x and 5.x systems in a Linux environment under bash.
for x in `seq -w 1 30`; do sar -b -f /var/log/sa/sa$x | gawk '/Average/ {print $2}'; done
This is sample output - yours may be different.
4789.98
4286.45
4286.23
4028.34
4108.42
812.15
3171.27
3696.37
4584.12
You need sysstat and gawk for this to work.
hddtemp /dev/sda /dev/sdb /dev/hda /dev/hdb | gawk '{print $NF}' | perl -n -e '$_ =~ s/(\d+)/print "$1 "/eg }{ print "\n"'
This is sample output - yours may be different.
get a list of temps of your hard-drives.
psql -U postgres -lAt | gawk -F\| '$1 !~ /^template/ && $1 !~ /^postgres/ && NF > 1 {print $1}'
This is sample output - yours may be different.
screen -ls | grep pts | gawk '{ split($1, x, "."); print x[1] }' | while read i; do gnome-terminal -e screen\ -dx\ $i; done
This is sample output - yours may be different.
connects to all the screen instances running.
find . -type f -print0 | xargs -r0 stat -c %Y\ %n | sort -rn | gawk '{sub(/.\//,"",$2); print $2}' > /tmp/playlist.m3u
This is sample output - yours may be different.
Tekzilla_Daily_Tip_HD_Quicktime/Firefox_Save_Websites_As_An_Image_-_Tekzilla_Daily_Tip.mp4
MacBreak_Weekly/MacBreak_Weekly_130_I_Did_A_Fiduciary_Dooty.mp3
Buzz_Out_Loud_from_CNET/Buzz_Out_Loud_922_Hot_and_junky.mp3
The_Totally_Rad_Show_HD_Quicktime/Nash_Out_-_Halo_Wars,_Street_Fighter_The_Legend_of_Chun_Li,_Green_Hornet_and_Clue_news,_Oscar_wager_results_-_The_Totally_Rad_Show.mp4
FRAK/FRAK_0.0.5.mp4
Tekzilla_Daily_Tip_HD_Quicktime/OS_X_Perfect_Windows_Management_Expose_and_Spaces_Together_-_Tekzilla_Daily_Tip.mp4
IT_Conversations/Dion_Almaer,_Ben_Galbraith_-_Bespin.mp3
Leo_Laporte_-_The_Tech_Guy/Leo_Laporte_-_The_Tech_Guy_539.mp3
Systm_HD_Quicktime/UPS_+_Car_Battery_=_More_Computing_Or_a_48_Hour_Disco_Ball_-_Systm.mp4
Praia_das_Mas/Praia_das_Mas_3.m4a
.....
I use this to generate a playlist with all the podcasts I listen to.
Ordered from most recent to older.
mysql -u uname dbname -e "show tables" | grep -v Tables_in | grep -v "+" | gawk '{print "optimize table " $1 ";"}' | mysql -u uname dbname
This is sample output - yours may be different.
mysql -u uname dbname -e "show tables" | grep -v Tables_in | grep -v "+" | gawk '{print "drop table " $1 ";"}' | mysql -u uname dbname
This is sample output - yours may be different.
sudo lsof | awk '{printf("%s %s %s\n", $1, $3, $NF)}' | grep -v "(" | sort -k 4 | gawk '$NF==prv{ct++;next} {printf("%d %s\n",ct,$0);ct=1;prv=$NF}' | uniq | sort -nr
This is sample output - yours may be different.