Questions tagged [tcl]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
2answers
31 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
1answer
73 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
2answers
62 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
1answer
89 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
1answer
49 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
1answer
18 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
1answer
194 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
0answers
8 views

WSN implemented in NS2: Packets that are collected by Cluster heads are not being received by the Sink. Why?

what is the most appropriate and convenient protocol to be used in ns2 (udp or tcp)? and which type of agents must be used in order to force the nodes which received packets to resend the same ...
0
votes
1answer
506 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: ...
0
votes
1answer
1k 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
0answers
66 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 ...
0
votes
1answer
257 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
3answers
244 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
2answers
981 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
2answers
374 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
3answers
570 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 ...
1
vote
1answer
4k 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
2answers
2k 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
1answer
184 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
1answer
228 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
1answer
1k 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
1answer
7k 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
3answers
7k 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
2answers
452 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
2answers
2k 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
1answer
629 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
2answers
403 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
1answer
161 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
0answers
1k 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
1answer
147 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
2answers
634 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
0answers
314 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
1answer
144 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
0answers
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
2answers
1k 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
1answer
693 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
3answers
10k 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
2answers
2k 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 ...
2
votes
1answer
1k 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
2answers
899 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
0answers
102 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
0answers
952 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
1answer
342 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
1answer
754 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?
2
votes
3answers
677 views

Extracting time from logs using tcl, expect

I have logs with the following pattern: 1,30.10.2014,07:51:07,0,0,1,12,28,255,3,255,255,255,0,0,0; 2001,30.10.2014,07:51:07,0,0,0,300,5,0,255; I need to extract date and time... for the first line I ...
6
votes
2answers
16k views

Create a directory if it doesn't exist in TCL

I write expect script that login to remote machine and run there some scripts But I need also to verify the following Verify if directory /var/cti/adm/APP exists. If APP not exists under adm ...
1
vote
1answer
1k views

TCL script try catch

I have a TCL script that sets a number of variables and reads several files. The last file it reads may contain sensitive information, so I need to make sure this file gets deleted even if an error ...
0
votes
1answer
135 views

How to configure Apache Rivet on openSUSE with YaST2

I need to configure my Apache web local server to view Tcl Apache Rivet web dynamic applications. The problem I run into is my browser forces me to download the file, so Apache doesn't interpret the ...
1
vote
1answer
848 views

How can I return a specific error code at this point in my TCL script?

I have a TCL expect script that runs a scp command for uploading a config file to my DNS server: #!/usr/bin/expect -f set config "~/dnsmasq.conf" spawn /usr/bin/scp "$config" root@192.168.1.1:/etc/...
0
votes
2answers
16k views

How to execute grep in tcl for getting XYZ-123 type pattern

How can I execute this grep command in TCL? grep '[A-Z][A-Z][A-Z]\-[0-9][0-9][0-9]' file1 > file2