Tcl and clear case to obtain a file name as variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Tcl and clear case to obtain a file name as variable
# 1  
Old 06-05-2013
Tcl and clear case to obtain a file name as variable

Code:
proc get_view_rel_str {  } {

set cc_view [string trim [lindex [split [exec /opt/rational/clearcase/bin/cleartool pwv] :] end]]
puts $cc_view
set a [exec cleartool setview -exec "ls /mvfs/fos-6000/build/swdl/cpp8548/freebsd/*.CON" $cc_view]
puts $a
set a [string trim [lindex [split $a /] end]]
puts $a
set a [regsub {\.CON$} $a {}]
puts $a
set a [regsub {CPP0} $a {}]
puts $a
set a [regsub {0} $a {.}]
puts $a
}
get_view_rel_str


this is a script in tcl with clearcase view
the above code gives the output as

Code:
view_name_15
/dir/6000/ild/swl/cp5/frd/CPP07011.CON
CPP07011.CON
CPP07011
7011
7.11

but the required output is "R7.1.1" without quotes
can anyone please let me know how do we obtain this.
and also pls help to refine the script to be very simple and short
thanks in advance

---------- Post updated at 11:57 AM ---------- Previous update was at 10:52 AM ----------

I can use join to make the output as R7.11
but i need R7.1.1
and an optimized code.. some one pls help

---------- Post updated at 03:39 PM ---------- Previous update was at 11:57 AM ----------

can anyone help?
# 2  
Old 06-05-2013
Test for two dots and if not, add dot between first pair of digits.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to obtain a variable between subroutines

#!/usr/bin/bash sub1 () { for ((i=0;i<10;i++)) do export a=$i; echo "value of a is $a"; sleep 1 done } sub1 & sub2 () { for ((j=0;j<10;j++)) do echo "value of a is $a"; sleep 1 done } (5 Replies)
Discussion started by: Arun_Linux
5 Replies

2. Shell Programming and Scripting

how to parse this file and obtain a .csv or .xls

Hello Expert, I have a file in the following format: SYNTAX_VERSION 5 MONITOR "NAME_TEMPLATES" DESCRIPTION "Monitors for contents of error " INTERVAL "1m" MONPROG "script.sh NAME_TEMPLATES" MAXTHRESHOLD GEN_BELOW_RESET SEVERITY Major ... (17 Replies)
Discussion started by: Ant-one
17 Replies

3. Shell Programming and Scripting

Howto set string variable in TCL?

Anyone knows how to set variable in TCL ? let say i have a password variable and it will have different values. set variable and variable has different values like: xxxx yyyy zzzz (0 Replies)
Discussion started by: linuxgeek
0 Replies

4. Shell Programming and Scripting

Variable substitution in TCL

Hi, I have a scenario in which I have to substitute the variable to call the procedure "login" in Tcl. for {set i 1} {$i<=2} {incr i} { login "$spawn_id$i" } I have the variables $spawn_id1 and $spawn_id2 in the beginning of the script which I'm trying to pass to the procedure "login". So... (2 Replies)
Discussion started by: arun_maffy
2 Replies

5. Shell Programming and Scripting

Setting Variable in TCL to be understood by KSH Shell

Hi , I am having one TCL TK script , I am setting some variables in the GUI TK interface set DI 1 set MODELS_PATH /a/d/path but I want to make ksh shell understand the variables when I am running TK script I tried to do like this set a but it is not working ... (1 Reply)
Discussion started by: kshitij
1 Replies

6. Shell Programming and Scripting

how to convert value in a variable from upper case to lower case

Hi, I have a variable $Ctrcd which contains country names in upper case and i want to convert them into lower case. I have tried so many solutions from already existing threads but couldn't get the correct one. Can anybody help me with this..... Thanks a lot.. (2 Replies)
Discussion started by: manmeet
2 Replies

7. Shell Programming and Scripting

Clear Case, Awk and script

Hello. I should have asked this awhile ago but here is my situation. My task is to generate LOC for different directories. I have a text file that has dates in this format (01-Aug-2006). My task is to read each line and compare it to a branch date. Depending on the date, it should generate a... (0 Replies)
Discussion started by: mastachef
0 Replies

8. UNIX for Advanced & Expert Users

obtain duplicate keys in csv file

Hi, having two csv files, both sorted, by key (column1), f1 containing duplicate keys and f2 containing no duplicate keys, how can I obtain all rows from f1 with the keys listed in file2? Example: f1 is: k1,gsj01fd k2,vi982cj k2,1fjk01e k3,81kjfds k4,sd9dasi f2 is: k2 k3 and I... (3 Replies)
Discussion started by: oscarmon
3 Replies

9. UNIX for Dummies Questions & Answers

Clear Case views on UNIX

Friends, I was asked to work on Clear Case after setting up. For this created a dynamic view by using the command, 'cleartool mkview -tag <view name> -stgloc viewstg'. Now I am not sure how to proceed further :-( May I request you to help me out in continuing further. I have a deadline in... (1 Reply)
Discussion started by: mmohan
1 Replies

10. Shell Programming and Scripting

obtain a new variable out of "for statment"

first i have pre-define some variable, then input those into a for statement for some process, finally, i want to get a new value out of it. A=192.168.16.1 B=192.168.32.1 C=192.168.64.1 for i in A B C do echo $i | nawk -F. '{ if ($3 > 16 and < 32) ....something like that, then ( $i=... (7 Replies)
Discussion started by: 3Gmobile
7 Replies
Login or Register to Ask a Question