Regexp in tcl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Regexp in tcl
# 1  
Old 04-24-2013
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"
set old_release [string replace $old_release 0 0 0]
set old_release [string replace $old_release 2 2 0]
set old_release [string replace $old_release 4 4]

---------- Post updated at 05:19 PM ---------- Previous update was at 05:19 PM ----------

i need in regexp as a single command

---------- Post updated at 05:53 PM ---------- Previous update was at 05:19 PM ----------

can anyone help???
# 2  
Old 05-02-2013
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

TCL script to delete a pattern(regexp)

Hi I am writing a TCL script to delete a certain in a file My Input file 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; (1 Reply)
Discussion started by: kshitij
1 Replies

2. What is on Your Mind?

A Regexp You Can Use Everywhere

¯\_(ツ)_/¯ bakunin (0 Replies)
Discussion started by: bakunin
0 Replies

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

4. Shell Programming and Scripting

Regexp

I would like to extract "1333 Fairlane" given the below text. The word "Building:" is always present. The wording between Building and the beginning of the address can be almost anything. It appears the the hyphen is there most of the time. Campus: Fairlane Business Park Building:... (9 Replies)
Discussion started by: bbaker@copesan.
9 Replies

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

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

7. UNIX for Dummies Questions & Answers

print the line immediately after a regexp; but regexp is a sentence

Good Day, Im new to scripting especially awk and sed. I just would like to ask help from you guys about a sed command that prints the line immediately after a regexp, but not the line containing the regexp. sed -n '/regexp/{n;p;}' filename What if my regexp is 3 word or a sentence. Im... (3 Replies)
Discussion started by: ownins
3 Replies

8. Shell Programming and Scripting

Help with regexp

Hi there! I would like to know how to find and replace all numbers in a *.html file and make them bold. Any help will be appreciated! :) (7 Replies)
Discussion started by: agasamapetilon
7 Replies

9. Shell Programming and Scripting

regexp help

I'd like to know if there is a catchall line for renaming the following patterns: s01e03 -> 01x03 s4e9 -> 04x09 s10e08 ->10x08 and possibly even: 318 -> 03x18 1002 ->10x02 if its the first 3 or first digit number in the string. thanks! (0 Replies)
Discussion started by: TinCanFury
0 Replies

10. 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
Login or Register to Ask a Question