Data handling in tcl

Issue

This Content is from Stack Overflow. Question asked by Boggarapu Lokesh

I have a line like this in a.txt file.

/a/lock/lock34/string1_blast_gh_4_0_1_string2_blast_fsr_t_6_0_string3_blast_rtpr_5_bilevel_8_6_string4_blast_lockt_mnt_ys_0_7

Now i want the same above line to be printed as below.

But when i give particular string from input file in the terminal as:

‘string1_blast_gh_4_0_1’ then i have to get 1st line in expected output as output.

‘string2_blast_fsr_t_6_0’ then i have to get 2nd line in expected output as output.

‘string3_blast_rtpr_5_bilevel_8_6’ then i have to get 3rd line in expected output as output.

‘string4_blast_lockt_mnt_ys_0_7` then i have to get 4th line in expected output as output.

Expected output:

/a/lock/lock34/string1_blast_gh_4_0_1_string2_blast_fsr_t_6_0_string3_blast_rtpr_5_bilevel_8_6_string4_blast_lockt_mnt_ys_0_7/ptr1

/a/lock/lock34/string1_blast_gh_4_0_1_string2_blast_fsr_t_6_0_string3_blast_rtpr_5_bilevel_8_6_string4_blast_lockt_mnt_ys_0_7/ptr2

/a/lock/lock34/string1_blast_gh_4_0_1_string2_blast_fsr_t_6_0_string3_blast_rtpr_5_bilevel_8_6_string4_blast_lockt_mnt_ys_0_7/ptr3

/a/lock/lock34/string1_blast_gh_4_0_1_string2_blast_fsr_t_6_0_string3_blast_rtpr_5_bilevel_8_6_string4_blast_lockt_mnt_ys_0_7/ptr4

Any input is appreciated.
Thank you.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?