Issue in regards with TCL script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Issue in regards with TCL script
# 1  
Old 03-23-2010
Network Issue in regards with TCL script

Hi ,

I am having one File "free" contents are like this

Code:
module KANDI ( DQS2SD0,.DQW09X2SEL2(
DQW09X2SEL[0]),.DQS3MUXSW2(DQS3MUXSW[1]),.DQW05X1SEL1(DQW05X1SEL1]),DQ00OUT06,.DQS0APRW3DQS0APRW4]),DQ07OUT08,S1ENSLICENDRV2,.DELAY2OFF1(DELAY2OFF[2]),.DQR00X1SEL2(DQR00X1SEL[0]),.DQR16X2SEL1(DQR16X2SEL[1]),.DQR20X1SEL2(DQR20X1SEL[0]),DQ20OUT13,DQ10OUT11,DQS1MUXCLKC,DQS3MUXCLKC,DQ06PAD,DQ05OUT00,DQ11RDPTR0,DQ12RDPTR2,S0PRSTGH0,.

I need to write one TCL script so that it will sreach the "," and split the contents into individual lines

like this

Code:
module NEOANA18 ( DQS2SD0,
.DQW09X2SEL2(DQW09X2SEL[0]),
.DQS3MUXSW2(DQS3MUXSW[1]),
.DQW05X1SEL1(DQW05X1SEL[1]),
.DQS0APRW3(DQS0APRW[4]),
DQ07OUT08, .... and so on

I tried the below TCL script but it is not working:


Code:
#########################################
 
 
set file1 [open "free" r];
set contents [ read $file1 ];
#set lines ""
#while { [gets $contents lines ] >= 0 } {
foreach line $contents {
if { [regexp "\," $line  ]  == 1 } {
set a [split $line "\n"]
echo "$a"
}
}
#gets $contents lines;
#}
#close $contents;
#############################################

Please help me out as soon as possible

Thanks and Regards
Kshitij

Last edited by pludi; 03-23-2010 at 03:50 AM.. Reason: code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

TCL script help

Hi All , I am having a file as stated below File 1 chain = chan6 group = grp0 input = '/pad_pc10' output = '/pad_pb7' length = 9900 chain = chan2 group = grp0 input = '/pad_pa4' output = '/pad_pb12' length = 10000 chain = chan7 group = grp0 input = '/pad_pb2' output =... (1 Reply)
Discussion started by: kshitij
1 Replies

2. Red Hat

Issue in installing expect and Tcl

Hi I need to install expect in redhat. through net I came to know that I must install tcl too in order to make expect work. I have downloaded both packages but not able to install # ls -lrt total 3720 18:33 tcl8.4.20-src.tar.gz 18:33 expect5.45.3.tar.gz 18:40 expect5.45.3... (7 Replies)
Discussion started by: scriptor
7 Replies

3. Shell Programming and Scripting

Special Character issue in Expect Utility (Tcl)

Hi, I have written a unix expect utility "ssh-login.exp" which connects (ssh) to remote host and execute some shell script. I am calling this "ssh-login.exp" utility from another shell script. "ssh-login.exp" takes username, password, host and shell script path to execute on remote host. All... (1 Reply)
Discussion started by: Mahesh Desai
1 Replies

4. Shell Programming and Scripting

Help using regexp in a TCL script ??

In a tcl script I need to find a way of reading a file, and looking for a phrase ("set myvariable") and putting the word following that into a variable. I've used a file open, and a while loop with gets to read each line from the file into a variable, and using regexp searched for the item. I'm... (1 Reply)
Discussion started by: Tonyb61
1 Replies

5. Shell Programming and Scripting

Help with TCL script

I need to read a file, the file has a table in it. From the table I need to choose all the rows for which AVG 2 value is greater than 0.050 and write them on to a separate file. Please help me with the TCL script for this. Thanks in Advance (0 Replies)
Discussion started by: tonystark
0 Replies

6. Programming

Tcl script

Dear Users I'm struck by while the following tcl script. foreach l { set w($l) {} set fsum 0 foreach ftemp $f($l) { set fsum lappend w($l) $fsum } } It shows me error as "missing operand at _@_ in expression "0.10308400000000001 + _@_* 0.4 * 1" ... (0 Replies)
Discussion started by: bala06
0 Replies

7. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

8. Shell Programming and Scripting

TCl issue

Hello, I am using in a tool the following tcl expression: 0] eq "prepaid" || $SM(b_mvpn_number) eq ""} && $SM(PTC_B.Subtype) ne "DualSIM"}{$SM(PTC_B.Number)} {$SM(b_mvpn_number)} ] 0] eq "prepaid" || $SM(b_mvpn_number) eq ""} && $SM(PTC_B.Subtype) ne "DualSIM"}{$SM(PTC_B.Number)}... (0 Replies)
Discussion started by: chriss_58
0 Replies

9. Shell Programming and Scripting

TCL TK SCRIPT Help Please

Hi Seniors, Need a help from your end. I am new to scripting and still in the learning process of scripting. I have written a script on TCL TK. This is the script that i have written. if { $EssEntityType == "rss_user" && $EssAction == "Insert" } { puts $fp " Ess Action :$EssAction" ... (0 Replies)
Discussion started by: tech90210
0 Replies

10. Shell Programming and Scripting

Sed Script in TCL

Hi, I am trying to run the following in my tcl script--- set ul *//;s/*$//;/^$/d;s/^/"20080401 09:43:08.770798,/;s/$/"/;s/,/","/g} | \ /bin/awk -F, {{print $1","$2","$3","$4","$5}} | \ sed '1i\ REPORT.TIMESTAMP.s,REPORT.CUSTOMER.s,REPORT.CODE.s,REPORT.A_CODE.s,REPORT.DESCRIPTION.s' \ >... (2 Replies)
Discussion started by: MrG-San
2 Replies
Login or Register to Ask a Question