Using sed in Applescript

Hi all,

I understand sed and the use of it, but I’m having a hard time converting it to something that will run in Applescript.

Here is the line that runs correctly at command line:

sed “s/(BACKUP=)(.*)/\1yes/” .macinfo > .macinfo.tmp

It’s searching for the string that comes after BACKUP= and changing the answer to either yes or no, depending up on the conditions.

Can someone please help me translate to Applescript?

Thank you so much, in advanced!!

I do not understand the type of your problem exactly. If it is about the escaping of escape characters (backslash for example) and quotation marks, there is a simple (almost stupid) trick, saving a lot of brain twisting:

Type the string in TextEdit and run the simple AppleScript

tell application "TextEdit"
	text of document 1
end tell

Copy the string from the result pane. Your entire sed string becomes

“sed "s/\(BACKUP=\)\(.*\)/\1yes/" .macinfo > .macinfo.tmp”

for example.



That is way cool! Thank you for that little helper tip!!!

That is exactly my problem. The backslashes and quotes and how to address them in Applescript!