Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Intelligent

macrumors 6502a
Original poster
Aug 7, 2013
922
2
Im coding a simple applescript application for personal use, so don't complain if it doing it the wrong way. Heres a line where i get an error


Code:
set path137 to quoted form of POSIX path of (choose file with prompt "Please choose a text file to perform the action on")
set text28 to text returned of (display dialog "Type in a pattern, all lines not including this pattern will be deleted"
set sedscript1 to "sed -i '@text28@!d' " & path137
do shell script sedscript1
end


Heres the exact error

Code:
AppDelegate.applescript:205: error: Expected “,” but found end of line. (-2741)
Command /usr/bin/osacompile failed with exit code 1

One thing I'm not to sure of is if i can just put the variable in sed like that or do i have do do something similar like the blabla"& path

But right now i can't even compile it because of the error
 
add : ) at the end of the second line :)

Code:
set path137 to quoted form of POSIX path of (choose file with prompt "Please choose a text file to perform the action on")
set text28 to text returned of (display dialog "Type in a pattern, all lines not including this pattern will be deleted")
set sedscript1 to "sed -i '@text28@!d' " & path137
do shell script sedscript1
end
 
add : ) at the end of the second line :)

Code:
set path137 to quoted form of POSIX path of (choose file with prompt "Please choose a text file to perform the action on")
set text28 to text returned of (display dialog "Type in a pattern, all lines not including this pattern will be deleted")
set sedscript1 to "sed -i '@text28@!d' " & path137
do shell script sedscript1
end

Oops, stupid error :D

Thanks i also had to put

Code:
 sed -i [B]''[/B]
instead of
Code:
 sed -i

But i can't use a variable inside sed like that, do you know how to use it? (I'm refereeing to text28).
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.