Sponsored Content
Top Forums UNIX for Beginners Questions & Answers TCL script to delete a pattern(regexp) Post 303041044 by kshitij on Tuesday 12th of November 2019 09:41:52 PM
Old 11-12-2019
TCL script to delete a pattern(regexp)

Hi

I am writing a TCL script to delete a certain in a file

My Input file

Code:
module bist_logic_inst(a, ab , dhd, dhdh , djdj, hdh, djjd, jdj, dhd, dhp, dk
);
input a;
input ab;
input dhd;
input djdj;
input dhd;
output hdh;
output djjd;
output jdj;
output dk;




bist_reverse_mapper 
#(.ksks, jsjs, sjsk, hsjhs , hshs, hshjs, jsjs),
.dhdhd::hdhdhdhd),
kdkd,jdjd ,jdjd),
jdjd(jdjd))
Umbist_reverse_inst(  .BIST_SO(), .BIST_SO_ts1(), .BIST_SO_ts2(), .BIST_SO_ts3(), .BIST_GO(), .BIST_GO_ts1(), 
      .BIST_GO_ts2(), .BIST_GO_ts3(), .clk_mbist(), .BIST_SETUP(), .ltest_to_mcp_bounding_en(), 
      .MEM0_BIST_COLLAR_SI(), .MEM1_BIST_COLLAR_SI(), .MEM2_BIST_COLLAR_SI(), .MEM3_BIST_COLLAR_SI(), 
      .bistEn(), .BIST_COLLAR_DIAG_EN(), .ltest_to_en(), .BIST_EVEN_GROUPWRITEENABLE(), 
      .BIST_ODD_GROUPWRITEENABLE(), .BIST_SELECT(), .BIST_WRITEENABLE()
  );

endmodule


I have to delete the content in between # and ))

My output file

Code:
module bist_logic_inst(a, ab , dhd, dhdh , djdj, hdh, djjd, jdj, dhd, dhp, dk
);
input a;
input ab;
input dhd;
input djdj;
input dhd;
output hdh;
output djjd;
output jdj;
output dk;




bist_reverse_mapper 

Umbist_reverse_inst(  .BIST_SO(), .BIST_SO_ts1(), .BIST_SO_ts2(), .BIST_SO_ts3(), .BIST_GO(), .BIST_GO_ts1(), 
      .BIST_GO_ts2(), .BIST_GO_ts3(), .clk_mbist(), .BIST_SETUP(), .ltest_to_mcp_bounding_en(), 
      .MEM0_BIST_COLLAR_SI(), .MEM1_BIST_COLLAR_SI(), .MEM2_BIST_COLLAR_SI(), .MEM3_BIST_COLLAR_SI(), 
      .bistEn(), .BIST_COLLAR_DIAG_EN(), .ltest_to_en(), .BIST_EVEN_GROUPWRITEENABLE(), 
      .BIST_ODD_GROUPWRITEENABLE(), .BIST_SELECT(), .BIST_WRITEENABLE()
  );

endmodule

The script which I have written is

Code:
set filename6  "output_dir/mbisttop_${ip}.v"

# Read in the data; this is good even for pretty large files
set f_6 [open $filename6]
set lines3  [read  $f_6]
close $f_6


set pattern1  "#(.*?))"
set elim1 [regsub $pattern1 $lines3 ""]
set f_8 [open ff.v "w"]
puts -nonewline $f8 $elim1

But this one is not working .

Please tell me whether the below stated pattern is correct ?

Code:
set pattern1  "#(.*?))"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

tcl: regexp matching special character

Hello Experts, Can someone help me here: I have a variable which contains a string with "". set var1 {a} set str1 {a is the element i want to match} Now "regexp $var1 $str1" does not work? ("regexp {a\} $str1" works, but var1 gets it's value automatically from another script) Is... (6 Replies)
Discussion started by: sumitgarg
6 Replies

2. Shell Programming and Scripting

Extract words before and after a pattern/regexp

Couldn't find much help on the kind of question I've here: There is this text file with text as: Line one has a bingo Line two does not have a bingo but it has a tango Bingo is on line three Line four has both tango and bingo Now I would want to search for the pattern "bingo" in this file... (3 Replies)
Discussion started by: manthasirisha
3 Replies

3. Shell Programming and Scripting

Problem with regexp for IP-Adress Pattern

Hi all Unix Gurus! Since hours (even days :-)) I'm trying to find the correct pattern to search for IP addesses in text files. The pattern to find a IP address itself is not too difficult: '((||1{2}|2|2{2})\.){3,}(||1{2}|2|2{2})' BUT, of course the above pattern is also matching lines like... (9 Replies)
Discussion started by: desertchannel
9 Replies

4. Shell Programming and Scripting

Help!! Script to delete files other than specified pattern

Hi Experts, I want to delete all the files in a folder other than files with .zip extension using shell script. please suggest the code. Neeraj Chourasiya (3 Replies)
Discussion started by: nchourasiya
3 Replies

5. Shell Programming and Scripting

Question on TCL regexp and match

Hello everyone, I'm new in tcl scripting. I'm currently studying a tcl script and came across this line: regexp {(\d+)(\S?)} $opts match opt swi According to my understanding, this line means to search in the opts variable for one or more digit, followed by a non-whitespace character... (2 Replies)
Discussion started by: mar85
2 Replies

6. Shell Programming and Scripting

Question on regexp in TCL

I need some help with regexp in tcl. The following code does work if the $urlvar ends in jpg,jpeg,png or gif. Eg, protocol(http/https)://testsite.com/images/image1.jpg if { ! } { //Do something } My problem is that if the URL does not end in these extensions this regexp is of no... (1 Reply)
Discussion started by: ampak
1 Replies

7. Shell Programming and Scripting

Regexp in tcl

I need to change R3.1.5 as 03015 similarly R4.1.7 as 04017 i need a single command in tcl pls help ---------- Post updated at 05:19 PM ---------- Previous update was at 04:48 PM ---------- i had to do like this without using regexp set old_release "R3.1.5" ... (1 Reply)
Discussion started by: Syed Imran
1 Replies

8. 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

9. Shell Programming and Scripting

awk regexp to print repetitive pattern

How to use regexp to print out repetitive pattern in awk? $ awk '{print $0, "-\t-\t-\t-\t-\t-\t-\t-\t-\t-\t-\t-"}' output: - - - - - - - - - - - -I tried following which does not give what I want, of course. awk '{print $0, "-\t{11}-"}' output: - ... (10 Replies)
Discussion started by: yifangt
10 Replies

10. UNIX for Beginners Questions & Answers

sed script to delete the last word after a last pattern match

Hi Guys , I am having a file as stated below File 1 sa0 -- i_core/i_core_apb/i_afe0_controller/U261/A sa0 -- i_core/i_core_apb/i_afe0_controller/U265/Z sa1 -- i_core/i_core_apb/i_afe0_controller/U265/A sa1 -- i_core/i_core_apb/i_afe0_controller/U268/Z sa1 -- ... (7 Replies)
Discussion started by: kshitij
7 Replies
GST-CONVERT(1)							   User Commands						    GST-CONVERT(1)

NAME
gst-convert - Smalltalk syntax converter and beautifier DESCRIPTION
Usage: gst-convert [OPTION]... [INFILE [OUTFILE]] gst-convert [OPTION]... -o|--output OUTFILE INFILES OPTIONS
-q, --quiet don't show any message -v, --verbose print extra information while processing -f, --format=FORMAT convert from given input format (supported formats are gst, gst2, sif, squeak) -F, --output-format=FORMAT convert to given output format (supported formats are gst, gst2, squeak) -C, --class=REGEX convert only classes matching REGEX -C, --class=+REGEX in addition, convert classes matching REGEX -C, --class=-REGEX do not convert classes matching REGEX -c, --category=REGEX convert only classes whose category matches REGEX -c, --category=+REGEX in addition, convert those whose category matches REGEX -c, --category=-REGEX do not convert classes whose category matches REGEX -r, --rule='CODE->REPL' look for CODE and replace it with REPL -o, --output OUTFILE concatenate multiple input files into a single converted output file --help display this message and exit --version print version information and exit SEE ALSO
The full documentation for gst-convert is maintained as a Texinfo manual. If the info and gst-convert programs are properly installed at your site, the command info gst should give you access to the complete manual. gst-convert version 3.2.4 December 2011 GST-CONVERT(1)
All times are GMT -4. The time now is 09:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy