This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Replace line in the file

Help for those learning Tcl or writing their own scripts.
Post Reply
H
Hiter
Voice
Posts: 1
Joined: Sun Feb 24, 2013 4:33 pm

Replace line in the file

Post by Hiter »

Hi.

How replace a specific line in the file?

e.g
1. <html>
2. <head>
3. <p><center>Hello WORLD!!!</p></center>
4. <p> How are you </p>
5. </head>
6. </html>

And how to replace 4 line text: Do You love dogs?
I do not want to pre-script.
I need a formula that turns the text on the specific line.

Thanks.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Try the 'EditTextFile Version 0.3' on this forum string...
http://forum.egghelp.org/viewtopic.php?p=100292#100292
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

set text [join [lreplace [split $text "\n"] 3 3 "Do you love dogs?"] "\n"]
Post Reply