Forum Discussion

Ddib_147504's avatar
Ddib_147504
Icon for Nimbostratus rankNimbostratus
Mar 14, 2014

Problem with string map : TCL

Hi Team,

 

I test this two commands to replace $num with $num_fin in each ligneptf but with no result, the file isn't modified

 

string map -nocase [list $num $num_fin] $ligneptf

 

puts [string map -nocase [list $num $num_fin] $ligneptf]

 

if you have an idea , thank you in advance.

 

2 Replies

  • Hi,

    It should work but your problem may comes from that you didn't save this "new" variable. It replaces every occurrence but you have to save it manually.

    For example what you can do is :

    set new_ligneptf [string map -nocase [list $num $num_fin] $ligneptf]
    
  • thank you, it works but it copies the line on the next line, can we replace the line directly in the same file without creating a new temp file?