I've got a bit of applescript that will remove the first line of a CSV file. I have a variable $path that contains the filepath of the CSV.
The native applescript works perfectly:
tell application "Finder"
do shell script "sed -i \"\" '1 d' " & quoted form of POSIX path of "/Users/username/Desktop/TheFile.csv"
But I need to put the $path variable in instead of the absolute data, because the path could change.
When I try to calculate it, it keeps failing. I know that it has something to do with escaping the various characters inside but I'm admitting defeat and hoping someone smarter than I can help me.
Here's what I've been trying:
"tell application \"Finder\"¶
do shell script \"sed -i \\\"\\\" \'1 d\' \" \& quoted form of POSIX path of \""&$path&"\"¶
Any ideas? I have tried only escaping the " and \ marks, but that also fails.