INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

parse multiple lines text file to print in single line

parse multiple lines text file to print in single line

parse multiple lines text file to print in single line

(OP)
I am doing some tcl scripting to parse the report with format as below and to print the output without the header and with just single line like -

Connections for net 'pmg_ccu_ot2_tam_50mhz_sel_xainfwh' :: Driver a_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh Output Pin (a_par) :: Load b_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh Input Pin (b_par)
Connections for net 'pmg_ccu_ot2_tam_50mhz_sel_xainfwh_2' :: Driver d_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh_2 Output Pin (d_par) :: Load e_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh_2 Input Pin (e_par), f_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh_3 Input Pin (f_par)
<more . . .>

I tried a few times but just could not get what I want. Really appreciate if anyone can give some light and idea to me. Thanks much!


****************************************
Report : net
-connections
Design : soc
Version: G-2012.06-SP2
Date : Sun Apr 7 22:56:33 2013
****************************************


Connections for net `pmg_ccu_ot2_tam_50mhz_sel_xainfwh`:

Driver Pins Type
------------ ----------------
a_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh Output Pin (a_par)

Load Pins Type
------------ ----------------
b_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh Input Pin (b_par)

1


Connections for net `pmg_ccu_ot2_tam_50mhz_sel_xainfwh_2`:

Driver Pins Type
------------ ----------------
d_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh_2 Output Pin (d_par)

Load Pins Type
------------ ----------------
e_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh_3 Input Pin (e_par)
f_par/pmg_ccu_ot2_tam_50mhz_sel_xainfwh_3 Input Pin (f_par)

1

<more . . .>

RE: parse multiple lines text file to print in single line

What do you know about the header: number of bytes? number of lines? If number of bytes you can read past the header:

set fid [open <filename> r]
set hdr [read $fid numbytesinheader]

Now you can read the rest into a list of lines:

set lines [split [read $fid] \n]

Now you can make that into a single line:

set strData [join $lines " "]

Now if you really wanted multiple lines (you weren't really clear):

set strData [string map {Connection \nConnection} $strData]

_________________
Bob Rashkin

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close