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
dtc_kill_vps_disk(8)					      System Manager's Manual					      dtc_kill_vps_disk(8)

NAME
dtc_kill_vps_disk - destroy LVM disks for freeing space SYNOPSIS
dtc_kill_vps_disk VPS_NUMBER [ lvm|loopback ] DESCRIPTION
dtc_kill_vps_disk This shell script is a part of the dtc-xen package that is to be used by the dtc panel to manage a Xen VPS server. This script is used to delete a partitions that was used by a VPS. It will delete the normal partition that was used as a root disk, and the swap partition. dtc_kill_vps_disk is to be used by the dtc-xen SOAP server, but can also be used as a standalone userland tool. OPTIONS
VPS_NUMBER has to be a number between 01 and 19. Let's say the number is 16, and that dtc-xen is configured to use the volume group called lvm1, then this script will create /dev/lvm1/xen16 and /dev/lvm1/xen16swap. IMAGE_TYPE This parameter can have 2 values: either lvm or loopback. If ommited, then lvm is used. If lvm is used, then this script will create a partition using lvmcreate, otherwise it will create an image file. Both will later be used for the VPS. EXAMPLE
dtc_setup_vps_disk 04 lvm This will delete the 2 LVM partitions that were used by the VPS named xen04, the first one being the root partition, and the second one being the swap partition. VERSION
This documentation describes dtc_kill_vps_disk See http://www.gplhost.com/software-dtc-xen.html for updates. SEE ALSO
dtc_reinstall_os(8), dtc_setup_vps_disk(8) dtc_kill_vps_disk(8)
All times are GMT -4. The time now is 03:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy