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@lists.hosef.org mailing list
http://lists.hosef.org/cgi-bin/mailman/listinfo/luau

Reply via email to