Questions tagged [tcl]
The tcl tag has no usage guidance.
58
questions
1
vote
4
answers
110
views
How to remove entire string that match specific pattern in unix txt file with a single command line
I would like to remove all the strings that contain "vcc".
Example:
s_regscan_ctrl_lab_2_regscan_ce[0] s_regscan_data_l_regscan s_t_regscan_data_tieoff_regscan vcc_cram_viort1_6_t
...
0
votes
1
answer
235
views
TCL - Error in startup script: expected integer but got "Sans"
I am trying to run a tcl script using wish as
$ wish main.tcl
output of the command is
Error in startup script: expected integer but got "Sans"
(database entry for "-font" in ...
-1
votes
1
answer
547
views
How to grep the difference between two files into a file
Saying that I have two files: a.txt and b.txt.
The content of a.txt:
mosfet23
cap098
inductors 98
metal96
The content of b.txt:
test 23 cap098
drc45 metal96
lvs cap098
Of course I can use vimdiff to ...
0
votes
1
answer
892
views
Installation of core emulator : 'tcl8.5' not installing
I'm trying to install core emulator on Ubuntu 20.04 and I came across an installation procedure and it had the following command
$ sudo apt-get install bash bridge-utils ebtables \
iproute libev-dev ...
0
votes
2
answers
1k
views
Tcl command to find latest created folder in a directory
i have a folder where there are subfolder with dates
example : Parent/2020-11-09_15.47.36
Parent/2020-11-10_16.52.02 and so on.
now I want to find out which is the latest date folder inside Parent ...
1
vote
1
answer
572
views
Expect exiting, not responding to text sent
I have an expect script that is exiting, instead of processing text that is sent and installing files. I'm trying to figure out why it's not installing files, i.e. not implementing what would be done ...
-1
votes
1
answer
59
views
Perform calculations on tabulated results and print the results in tabulated form
I have a report which displays the clock periods along with the clock names and duty cycle.
Now, I would like to use tcl or awk or perl to make it display with clock period interms of freq and the ...
1
vote
2
answers
828
views
How to print lines from file a file in a way of sequence i.e. sorted on basis of a specific column inside tcl script?
I want to print the file content based on sorting the 3rd column of sourcefile.
sourcefile.txt:
Manav Kumaom Fre
shailesh himadri aif
manisha Kailash mac
Ravi Jwala blu
Prakash Ojha Zan
Mahi Aulakh ...
0
votes
1
answer
3k
views
how to convert a list to array in tcl?
It may be a trivial question; but I am facing problem to covert a list to array inside a tcl script.
set mylist { one two three four five }
I need to convert this to array myArr.
One more doubt, Can ...
1
vote
2
answers
3k
views
How to use 'awk' in tcl script?
It might be trivial, but I am facing problem in using awk for simple purpose like printing first row in a file using tcl script.
I used the following command inside tcl script:
awk '/manager/ {print $...
0
votes
1
answer
1k
views
Exit out from loop on incorrect password in expect TCL shell script
I have written a code snippet in TCL expect to connect from Server 1 to Server 2 using ssh. Users already may have set passwordless communication between Server 1 and Server 2, or it may ask for a ...
0
votes
1
answer
275
views
Extract data from multiple nested parenthesis in TCL
I need another help, this is in continuation of Extract data from the nested parenthesis in bash,
I have input data like below with multiple blocks, I want to put a logic to check for network vlans ...
0
votes
1
answer
65
views
Expect - parse all occurrences of a pattern and store in a variable
I am trying to process multiple mac addresses from output of a program. Output is in below format -
Device B0:CA:68:CF:88:54 dev1
Device DC:16:B2:AE:FB:8F dev2
Device B0:CA:68:CF:88:11 dev3
Device DC:...
1
vote
1
answer
298
views
Upgrading from Python2.7.12 to Python 3.8.1 on macOS 10.15.2 Catalina in Wing IDE Shell
There are many threads online about making this upgrade. However, most people say not to remove the old Python2 - this can mess up the macOS on your system. I've thus installed Python3.8.1 (I needed ...
0
votes
1
answer
1k
views
Problem in using AWK in TCL expect
i am getting problem in using AWK command in TCK/TK
unix command:
var=`awk -v var1="^$line" -F "|" '$1~var1{print $1 }' sort-address-name-ip.txt | awk -v var2="$line$" '$0~var2'`
and i used as:
...
3
votes
2
answers
8k
views
how to send special characters in expect script?
I'm trying to send special characters (password) which contains #?!k;|C .
The password is dynamic and cannot be hardcoded in the script, so I'm passing it as variable as shown below
$ expect ./...
0
votes
0
answers
217
views
Tix package (.deb) installed, Tcl doesn't see it
I'm on Debian Sid, I have installed the tix package (as in sudo apt install tix) and later I've tried to load it, as in
$ tclsh
% package require Tk
8.6.8
% package require Tix
can't find package Tix
...
1
vote
1
answer
889
views
tcl cd/pwd command with regard to real/symbolic path
When I work under tcl environment, once I cd to a directory, even if the path I specify is its symbolic link, then no matter whether I run pwd -L or pwd -P, they all return the absolute path. This is ...
1
vote
3
answers
848
views
How to convert an alias for bash to an alias for csh? -> Or to tcl
alias s2st="ps -A | grep -E "a|b"" works for bash.
Then I tried to convert it for csh:
set-alias t2st 'ps -A \| grep -E "a\|b"'
But csh does quoting so different, I couldn't coupe with...
How ...
2
votes
2
answers
3k
views
using a variable as array name in TCL script (array)
The question is about TCL Arrays.
In my TCL script,
variable1 is a variable value obtained from other functions(value is something like PATH_xyz.)
variable2 is another variable obtained from other ...
0
votes
2
answers
936
views
Tcl script with multiple spawn expect and send
I am trying to automate the installation of certificate(s):q! in jboss server.
i wrote this rudimentary script:
#!/usr/bin/expect
set Temp_Dir "/tmp/install"
set jboss_sec "/opt/jboss/security"
set ...
-1
votes
3
answers
1k
views
How can I avoid this error "couldn't execute "des": no such file or directory"?
I'm trying to do encryption in Expect as outlined in this wiki on Ubuntu 16.04. I've installed tcllib
root@alarmux:/home/abdmin# apt-get install tcllib
Reading package lists... Done
Building ...
2
votes
2
answers
9k
views
Expect script error- extra characters after close-quote
Error while executing send if command, Not sure if I'm missing some tcl syntax.
#!/usr/bin/expect -f
# Get the list of hosts, one per line #####
set f [open "/tmp/host.txt"]
set hosts [read $f]
...
0
votes
2
answers
4k
views
Monitoring of disk space on multiple Linux server using expect script
I'm trying to write a script using Expect for monitoring multiple servers; the connections will be through ssh using a password.
My basic loop is self failing, I'm not sure whether Expect TCL ...
0
votes
1
answer
726
views
How to output multi-page output in expect to file without option prompts being logged
I have a script using expect to run some commands on machine over SSH.
There is a part of script which issues a commands that causes multi-page output that I want to have saved to file.
How can I ...
2
votes
1
answer
524
views
Expect wigs out when I use the single quote in [exec ls -h | grep '\.foo' ]
I am trying to store a list of specific files into a variable in expect.
In my script, I am trying to compile files that have different file extensions, like .foo, .bar.
In this example, I have the ...
0
votes
1
answer
2k
views
Reading expect script commands from file [closed]
I need to update configurations of several gateways...I have two files:
File 1 (ip.txt) : Holds gateways’ IP addresses --->
This files gets updated every month.
File 2 (cmd.txt): Holds commands to ...
1
vote
1
answer
10k
views
How to check whether a given path is a file or directory
I am using the command below in my expect script (in tcl/Tk) for checking whether the entered path is an individual file or directory:
set b [exec ./check.sh $file1 | awk -F {=} {{print $1}} ]
The ...
1
vote
3
answers
11k
views
Tcl regexp: How to check if variable contains number?
Below is my tcl script for checking if there is any 0-9 number find in the variable.
set a "abc"
if {[ regexp {[0-9]*} $a ]} {
puts "Found number in $a"
} else {
puts "...
0
votes
2
answers
681
views
Compose filename inside expect script
I have a file which several lines, let's say:
server_file.txt:
[main]
server1 param1 param2 param3
server2 param1 param2 param3
I want to take the first value of last column to compose a filename ...
1
vote
2
answers
4k
views
Check for a word in the expect output and add it to a text file [closed]
I have a code like this:
#!/opt/tools/unsupported/expect-5.39/bin/expect
set timeout 10
match_max 256
log_file report.txt
expect_after eof {exit 0}
spawn ssh -l user ip
expect "(yes/no)?" { send "...
0
votes
2
answers
1k
views
TCL Expect Not Writing To Output Buffer
I have noticed that my TCL/Expect Script is not writing to the Output Buffer.
`#!/usr/bin/expect -f
exp_internal 1; #Debug Expect
set username [lindex $argv 0]; #Takes Outside Argument
set password ...
2
votes
2
answers
787
views
Triggering a gui from an acpi event
I've made a tkinter app to handle the power button press, but it doesn't launch when it should. Although if I use echo hello>>~/junk as the acpi action, it adds a hello to junk for every power ...
0
votes
1
answer
224
views
CentOS - TCL script works from shell but fails in init.d
I have a TCL script in CentOS 6.5 that I run from shell, as root, with no problems. But if I run it as a service from init.d it fails.
Here is the init.d script:
#!/bin/bash
#
# camelot Camelot 11....
1
vote
0
answers
2k
views
configure failed because of See `config.log' for more details
I am trying to compile Tcl, but I got the following error:
~/apps/tcl8.6.6/unix> ./configure --prefix=$HOME/.local/Tcl
checking whether to use symlinks for manpages... no
checking whether to ...
1
vote
1
answer
314
views
substitute at beginning of line
I want to search a pattern and insert a character at the beginning of a line using regsub in TcL. I have to use TcL only
Input file
mna1 x a1 vss vbn nch_svt_mac nfin=nfin_n1 l=ln1
mna2 x a2 vss vbn ...
3
votes
2
answers
1k
views
rlwrap: tclsh multi-word autocompletion
How do I get multi-word autocompletion with rlwrap for tclsh?
Example: I type file <space> then pressing <tab> <tab> I only want to see the sub-commands to file, such as exists ...
2
votes
0
answers
338
views
Tcl/Expect: Can't set variable value correctly
I'm trying to get IPSec tunnel details from the router. After that fetch lines with IP addresses.
So, I have follow code:
send "show tunnel ipsec remote 10.10.10.10\r"
expect "local"
send "\r"
set ...
0
votes
1
answer
163
views
Ruby with Tk in Gentoo
How to emerge Ruby with tk/tcl support in Gentoo Linux. I've tried USE="tk" emerge ruby, but it didn't work. Furthermore there is no tk use flag according "https://packages.gentoo.org/packages/dev-...
2
votes
0
answers
2k
views
Installing Expect and TCL
I downloaded the source for expect5.45, and am attempting to install it. tclsh is on the system at /usr/bin/tclsh, but I'm not sure if that means the machine also has "tcl" installed?
The ...
1
vote
2
answers
2k
views
How to compile Python with (Active)Tcl 8.6?
I'm trying to compile Python 3.5.0 on CentOS 6 with Tcl 8.6. I did
./configure --with-tcltk-includes=I/opt/ActiveTcl-8.6/include --with-tcltk-libs=L/opt/ActiveTcl-8.6/libs --prefix=/home/aivar/...
0
votes
1
answer
1k
views
Expect script: How to expect a literal * character instead of * as glob or regex character
I have an expect script that spawns a connection to hunspell to check the spelling of a word. Unfortunately, if the word is in the dictionary, hunspell simply sends back a *. How can I tell expect to ...
2
votes
3
answers
18k
views
'Couldn't connect to display ":0.0"' error on Cygwin
I'm trying to run tclsh with tk and I get a display error:
no display name and no $DISPLAY environment variable
Then I try the following:
export DISPLAY=:0.0
And of course it says it couldn't ...
-1
votes
2
answers
3k
views
How to move forward in a line in bash with echo? [closed]
I am trying to make my bash (or tcl) script updates a line with three columns. After going back to the begin of the line I don't know how to move forward skipping some characters. I want to update ...
4
votes
1
answer
2k
views
Can't make ./configure find tcltk while building R
I am trying to build R-3.2.1 from source with support for tcltk, but anything I try don't work, since I get then in R:
> capabilities("tcltk")
tcltk
FALSE
I am running Debian 8, I have installed ...
1
vote
2
answers
2k
views
Unix command does not work in Tcl script
I'm new to Tcl and UNIX programming.
The following command works on the UNIX command-lines, but doesn't work in a Tcl script.
$ sort -b -k8 abc.txt | awk '!a[$1]++'
error out for 8 (-k8) and 1($1) ...
1
vote
0
answers
116
views
How to install iwidgets without root access and set the enviornment
Recently, I want to run a script (PWgui) which requires Tcl (Itk). The manual suggests that I have to install iwidgets4 beforehand. I am using the university cluster and don't have any root privileges....
1
vote
0
answers
1k
views
Why the output is not written to log from expect script
I am trying to write the output of the netcat command including the command also to a file by logging into remote servers.
But it is not writing. What am I missing ?
#!/usr/bin/expect -f
set user [...
1
vote
1
answer
607
views
Improving performance of numerical loops in tcl
I'm trying to improve the performance of a Tcl script. It is a simple random sample with replacement algorithm. I know it's better to do this in a more numerically orientated language, but the ...
-1
votes
1
answer
1k
views
How to get index value from list in tcl? [closed]
I have following set of keywords
set keywords {a b c d}. I want to print index value of c. How to do this in tcl?