logo       

Re: Unexpected replacement: msg#00055

editors.sed.user

Subject: Re: Unexpected replacement

> <menutree:TREENODE TEXT="Updates" EXPANDED="true"
> TREENODESRC="xmlfiles/Menu.xml" IMAGEURL="images/folder.gif"
> EXPANDEDIMAGEURL="images/folderopen.gif" FILENAME=""/>
>
> Here is the snipit from the batch file that invokes sed:
>
> SET /P Choice=Enter tree node text and press Enter:
> sed 62s/TREENODE\x20TEXT.*EXPAND/TREENODE\x20TEXT\x3D\x22"%
> Choice%"\x22\x20EXPAND/ <..\Incrementals.html > tmp.txt
>
> My expectation is that user input text from the variable %Choice%
> replaces "Updates". However, given an input of: New Node Name, here
> is what ends up in tmp.txt:
>
> <menutree:TREENODE TEXT="New Node Name"
> EXPANDEDIMAGEURL="images/folderopen.gif" FILENAME=""/>
>
> Why is sed not stopping at the first occurence of EXPAND?
> I'm sure that the answer is simple, but I just can't see it.

The "*" in sed is greedy, slurping up everything it can, including all
the way up to your EXPANDEDIMAGEURL. Some versions of sed may have a
non-greedy operator. However, it may be easiest to simply just
substitute up to "EXPANDED=" (rather than just up to "EXPANDED") and
then put the "=" back in the replacement.

-tim






------------------------ Yahoo! Groups Sponsor --------------------~-->
AIDS in India: A "lurking bomb." Click and help stop AIDS now.
http://us.click.yahoo.com/9QUssC/lzNLAA/TtwFAA/dkFolB/TM
--------------------------------------------------------------------~->

--

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/

<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/






<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise