Re: Sed replace oneline nogo in Applescript
Re: Sed replace oneline nogo in Applescript
- Subject: Re: Sed replace oneline nogo in Applescript
- From: BJ Terry <email@hidden>
- Date: Mon, 9 Feb 2004 23:32:14 -0800
What is it you're trying to accomplish? On my computer, I get identical
results with a do shell script and entering it into the terminal. (When
it's properly escaped, naturally). If I remove the 2, I get all lines
substituted, if I add the two, I get only the second line in the file
substituted:
test.txt
<H3>dog1</H3>
<H3>dog2</H3>
<H3>dog3</H3>
<H3>dog4</H3>
do shell script "sed -e '2s|<H3>\\(.*\\)<\\/H3>|<h3><a
href=\"\\.\\/\">\\1</a></h3>|' ~/Desktop/test.txt"
yields
"<H3>dog1</H3>
<h3><a href=\"./\">dog2</a></h3>
<H3>dog3</H3>
<H3>dog4</H3>"
do shell script "sed -e 's|<H3>\\(.*\\)<\\/H3>|<h3><a
href=\"\\.\\/\">\\1</a></h3>|' ~/Desktop/test.txt"
yields
"<h3><a href=\"./\">dog1</a></h3>
<h3><a href=\"./\">dog2</a></h3>
<h3><a href=\"./\">dog3</a></h3>
<h3><a href=\"./\">dog4</a></h3>"
Are these not the results for which you are searching?
BJ
On Feb 9, 2004, at 10:03 PM, Gnarlodious wrote:
The bugaboo is the "2" specifying the line number:
sed -e '2s|<H3>\\(.*\\)<\\/H3>|<h3><a href=\"\\.\\/\">\\1</a></h3>|'
Works in Terminal but not Applescript. If I remove the "2" it operates
on
all lines in the file.
What am I doing wrong?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.