Hi there
I’d searched now a lot, but I coudn’t find a working solution for this problem:
I have a CSV file that looks like this:
[format]Campaign, Channel, Title
ABCD,Channel1, 9
ABCD,Channel2, 2
ABCD,Channel3, 1
ABCD,Channel4, 10
ABCD,Channel5, 7[/format]
I’d like to sort the file by ‘Title’ with apple-script so it should look like this:
[format]Campaign, Channel, Title
ABCD,Channel3, 1
ABCD,Channel2, 2
ABCD,Channel5, 7
ABCD,Channel1, 9
ABCD,Channel4, 10[/format]
It seems that ignore the header is not that easy. So I tried first the sorting thing.
What I have so far:
set filePath to quoted form of POSIX path of "/Users/user/Desktop/test.csv"
do shell script "sort -k3 -t ',' -u -r " & filePath & " -o " & filePath
But this gives me this result:
[format]Campaign, Channel, Title
ABCD,Channel1, 9
ABCD,Channel5, 7
ABCD,Channel2, 2
ABCD,Channel3, 1
ABCD,Channel4, 10[/format]
Any Ideas what am I doing wrong, or is there another way to solve this?
Thank you very much in advance for your help.
Regards
Marth