[LUAU] Using SED to extract song, artist, and album from my iTunes Music List Export
Jim Thompson
jim at netgate.com
Tue Sep 26 11:57:40 PDT 2006
Julian, you're hurting me. At least awk lets you do a one-liner...
% awk -F \t '{printf("\"%s\" %s %s\n", $1, $2, $3)}' < itunes-export-
file
On Sep 26, 2006, at 8:32 AM, Julian Yap wrote:
> On Tue, 2006-09-26 at 07:59 -1000, Tim Newsham wrote:
>> If you know perl or python or some other more general scripting
>> language
>> with good regular expression support, its probably easier and cleaner
>> to implement what we did above and as others suggested, thats the
>> way to go. But, if you don't know one of those languages, learning
>> a little bit of sed or awk (or even cut) can get the job done and is
>> a lot easier to pick up than a new (general) language...
>
> Jim said in a later post that it's tab delimited.
>
> In Python, create a file, say 'reader.py':
> ------
> #!/usr/bin/python
>
> import csv
> import sys
>
> filename = sys.argv[1]
> csv_reader = csv.DictReader(open(filename, 'rb'), delimiter = '\t')
>
> for row in csv_reader:
> print '"%s" %s %s' % (row['Name'], row['Artist'], row['Album'])
> ------
>
> Takes one argument from the command line.
>
> So if given executable permissions:
> ./reader.py songs.txt
>
> Otherwise:
> python reader.py songs.txt
>
>
> ~ Julian
>
>
> _______________________________________________
> LUAU at lists.hosef.org mailing list
> http://lists.hosef.org/cgi-bin/mailman/listinfo/luau
More information about the LUAU
mailing list