'tcl string or regex expression to join the substring at last
Currently, I'm removing the first position substring, but I wanted to join the same first position substring at the last position for all the strings mentioned in the file (Note: Here each substring is categorized by underscore)
file.txt
A_Class
B_Class
A_Name_Student
B_Name_Student
Marks_Mid_Term_Student
Marks_Student_Subject
so far I tried to remove the first substring but was unable to join it at last,
set school [string range $school [expr {[string first "_" $school] + 1}] end]
Basically, I wanted to print it as
Class_A
Class_B
Name_Student_A
Name_Student_B
Mid_Term_Student_Marks
Student_Subject_Marks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
