> for file in $( ls . ); do if [ ! -s $file ]; then rm -f $file; fi; done
Of course you could just get over your fear of find and take a look at that man page. Perfect for a recursive search and delete all in one:
> find . -empty -delete
simple, no?
This is mainly somewhere for me to dump interesting tidbits of tech info. Stuff that I may forget but will need again in the future. For a proper blog, visit my electronics blog (http://www.fangletronics.com) or my wife's pre-school crafty blog (http://www.filthwizardry.com).
> for file in $( ls . ); do if [ ! -s $file ]; then rm -f $file; fi; done
> find . -empty -delete
> mysql -u paulbo -N <<< "SELECT name from proteins" | while read protein_name; do mysql -u paulbo -N "SELECT count(*) FROM data INNER JOIN proteins ON data.protein_id = proteins.protein_id where proteins.name = '${protein_name//\'/\\\'}'"; done
> mysql -u paulbo -N <<< "SELECT name from proteins" | while read protein_name; do echo ${protein_name//[-\/\:\'\"\(\) ]/_};done
ls
man page, but I only came across it a couple of days ago.ls
's inbuilt flat --hide
.
> ls -l
arg.txt
blarg.txt
foo.txt
...
interesting.sh
... # and a ton more *.txt files
zlargyblorg.txt
> ls -l --hide=*.txt
interesting.sh
hidden.csv