Re: [SLUG] text processing

From: Paul M Foster (paulf@quillandmouse.com)
Date: Wed Sep 17 2008 - 16:16:39 EDT


On Wed, Sep 17, 2008 at 01:20:48PM -0400, Eben King wrote:

> I just added a hierarchy to my mp3 directory; IOW, I created subdirectories
> "a"-"z" and "0-9" and moved each band/artist's directory to the
> subdirectory
> corresponding to the first letter of its name. So
> ~/home/mp3/Smith,_John/John's_Album/01_John's_First_Track.mp3 went to
> ~/home/mp3/s/Smith,_John/John's_Album/01_John's_First_Track.mp3 . Well and
> good. Really trimmed down the mp3 directory, and should especially help
> over SMB. Now, any idea how I go about fixing the m3u files (playlists)
> without recreating them? Their structure is:
>
> 1 #EXTM3U
> 2 #EXTINF:177,Aphex Twin _Come To Daddy_ 2 "Flim" (1997)
> 3 /home/eben/mp3/Aphex_Twin/Come_To_Daddy/2.Flim.mp3
> 4 #EXTINF:230,Aphex Twin _Come To Daddy_ 3 "Come To Daddy, Little Lord
> Faulteroy Mix" (1997)
> 5
> /home/eben/mp3/Aphex_Twin/Come_To_Daddy/3.Come_To_Daddy,_Little_Lord_Faulteroy_Mix.mp3
> 6 #EXTINF:345,Aphex Twin _Come To Daddy_ 4 "Bucephalus Bouncing Ball"
> (1997)
> 7 /home/eben/mp3/Aphex_Twin/Come_To_Daddy/4.Bucephalus_Bouncing_Ball.mp3
> 8 #EXTINF:310,Aphex Twin _Come To Daddy_ 5 "To Cure A Weakling Child,
> Contour Regard" (1997)
> 9
> /home/eben/mp3/Aphex_Twin/Come_To_Daddy/5.To_Cure_A_Weakling_Child,_Contour_Regard.mp3
>
> (The line numbers are from vim, not part of the file. And those aren't
> really in $HOME, ~/mp3 is a soft link.) Adding a _capital_ subdirectory is
> easy enough:
>
> :^\/s@/mp3/\(.\)@/mp3/\1/\1
>
> (assuming that doesn't do something disallowed in vim)
>
> But how do I make the subdirectory lower-case? Or is it easier to make a
> capital soft link to each subdirectory, do that, then delete the link?
>

I'm inclined to think you'd have to one of these for each letter of the
alphabet. Like:

:%s/home\/mp3\/A/home\/mp3\/a\/A/g

(Excuse me, as I'm not a whiz at Vim regexps). What you're doing is
substituting

home/mp3/A

with

home/mp3/a/A

Hopefully that's clear.

Paul

-- 
Paul M. Foster
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:57:47 EDT