Penguin
Diff: BashOneLiners
EditPageHistoryDiffInfoLikePages

Differences between version 10 and predecessor to the previous major change of BashOneLiners.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 10 Last edited on Saturday, May 1, 2004 8:57:48 pm by PerryLorier Revert
Older page: version 1 Last edited on Wednesday, March 17, 2004 1:40:16 pm by DanielLawson Revert
@@ -1,10 +1,26 @@
-!!Sort a directory of mp3s into directories like Artist/Album Name/ 
+!! Sort a directory of mp3s into directories like Artist/Album Name/ 
  
- for i in *.mp3; do ALBUM=` id3tool "$i " | grep Album | cut -d " " -f 3 | \  
- sed s/" " *$ // ` ; ARTIST =`id3tool "$i" | grep Artist | cut - d " " -f 3 | \  
- sed s/" " *$// `; [ "$ARTIST " ] && DIR ="$ARTIST /"; [ "$ALBUM " ] &&  
- DIR =${DIR}${ALBUM} /; [ "$DIR" ] && ( mkdir -p "$DIR "; mv "$i " "$DIR /") ; done 
+<verbatim>  
+ for file in *.mp3; do \  
+ eval $( id3tool "$file " | sed ' s/^[^:] * //; s/:[\t ]*/ ="/; s/[[:cntrl:]]//g; /./! d; s/ *$/" /' ) \  
+ { [ "$Artist" -o "$Album " ] && dir ="$Artist/$Album /" ; } || { [ "$Artist " ] && dir =" $Artist /" ; } || continue ; \  
+ mkdir -p "$dir " ; mv "$file " "$dir /" ; \  
+ done  
+</verbatim>  
  
-It uses id3tool to pull out the album and artist name, it strips some extra crap out of this (unneeded whitespace ), then it creates the directory and moves the mp3 into that dir
+It uses [ id3tool | http://nekohako.xware.cx/id3tool/] to read the [ID3] tag, instructs [SED] to massage the information into something that looks like [Shell] script, executes that to put values into variables, checks which variables are set, and if at least an artist name (optionally also album name ) is given , moves the file into that directory . (It's rather a mouthful for a oneliner, but hey.)  
  
-Note that using ' for i in *.mp3 ' works even if you have spaces in the filename
+!! Refresh the all [GPG] keys from the [KeyServer] without flooding it:  
+<verbatim>  
+ for uid in `gpg --with-colons --list-keys| grep "^pub" | awk -F: '{print $5}'`; do gpg --refresh $uid; sleep 5; done  
+</verbatim>  
+Alter the number after sleep(1) to change the speed of the refresh.  
+[Paid surveys | http://www.paidsurveysforall.com]  
+[BPO services | http://www.thuriam.com]  
+[BPO services | http://www.isourceindia.com]  
+[Media Transcription | http://media-transcription.thuriam.com]  
+[BPO India | http://www.thuriam.com]  
+[Data Processing | http://bpo.thuriam.com/data_processing.html]  
+[Technical Writing | http://technical-writing.thuriam.com]  
+[Seo Services | http://seo-services.thuriam.com]  
+[Callcenter India | http://call-centre.thuriam .com]