Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiline data to singleline

Status
Not open for further replies.

brprasad06041987

Programmer
Oct 17, 2022
2
0
0
IN
Hi Reader,

I have an attribute which has data entered in multiple lines.
Please let me know how to read this attribute and bring this multiline data into one single line

Ex:

From:
Line 1
Line 2
Line 3

To:
Line 1 Line 2 Line 3
 
Code:
puts "multi line:"
set my_string_input "Line 1\nLine 2\nLine 3"
puts $my_string_input

puts "\nsingle line:"
set my_string_output [join [split $my_string_input \n]]
puts $my_string_output

Output:
Code:
multi line:
Line 1
Line 2
Line 3

single line:
Line 1 Line 2 Line 3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top