Expected “,” but found end of line

Discussion in 'Mac Programming' started by Intelligent, Aug 15, 2014.

  1. Intelligent macrumors 6502a

    Intelligent

    Joined:
    Aug 7, 2013
    #1
    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
     
  2. Bruno09 macrumors 68020

    Joined:
    Aug 24, 2013
    Location:
    Far from here
    #2
    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
     
  3. Intelligent, Aug 15, 2014
    Last edited: Aug 15, 2014

    Intelligent thread starter macrumors 6502a

    Intelligent

    Joined:
    Aug 7, 2013
    #3
    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).
     

Share This Page