f



Newbie Tcl Question

Hello,

In Tcl, how can I extract the file name from a string that contains
the fullpath to the file, like so: C:\results\log\file.txt

How can I retrieve the 'file.txt' substring from the above string?

Thanks,
Nadeem

0
khannu (11)
7/29/2007 10:11:57 AM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

2 Replies
404 Views

Similar Articles

[PageSpeed] 58

 khannu@gmail.com wrote:

> In Tcl, how can I extract the file name from a string that contains
> the fullpath to the file, like so: C:\results\log\file.txt
> 
> How can I retrieve the 'file.txt' substring from the above string?

file tail {C:\results\log\file.txt}

HTH
Stephan

0
skuhagen (111)
7/29/2007 10:16:44 AM
khannu@gmail.com wrote:
> Hello,
> 
> In Tcl, how can I extract the file name from a string that contains
> the fullpath to the file, like so: C:\results\log\file.txt
> 
> How can I retrieve the 'file.txt' substring from the above string?

Read the man/help page on the file command, pay particular attention to the 
tail subcommand.


-- 
+--------------------------------+---------------------------------------+
| Gerald W. Lester                                                       |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
0
Gerald.Lester (2014)
7/29/2007 12:46:22 PM
Reply:

Similar Artilces:

Newbie Question (Tcl)
Hi This question is aimed at TCL people. How do I POST and GET XML text lines using the http library? I need a detailed answer please. Thanks afri ...

tcl-gaul: Genetic Algorithms for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-gaul Tcl-gaul is a Tcl extension for genetic/evolutionary algorithm processing.It relies on the GAUL library: http://gaul.sourceforge.net/ * A genetic algorithm (GA) is a search technique used in computing to find exact or approximate solutions to optimization and search problems. Genetic algorithms are categorized as global search heuristics. They are a particular class of evolutionary algorithms that use techniques inspired by evolutionary biology such as inheritance, mutation, selection, and crossover. For an introduction to genetic algorithms visit: http://gaul.sourceforge.net/intro.html Platform: Linux (GAUL library dependency) Home page: http://sourceforge.net/projects/tcl-gaul/ Man page: http://tcl-gaul.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-pam: PAM authentication for Tcl (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-pam Tcl-pam is a Tcl interface to the PAM* service of Linux. It provides a Tcl package that allows Tcl scripts to use PAM to authenticate users and programs. It relies on linux-pam library: http://www.kernel.org/pub/linux/libs/pam/ * PAM (Pluggable Authentication Modules): A mechanism to integrate multiple low−level authentication schemes into a high−level application programming interface (API). This enables programs that rely on authentication to be written independently of the underlying authentication scheme. Platform: Linux Home page: http://sourceforge.net/projects/tcl-pam/ Man page: http://tcl-pam.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-syslog: Unix system logging for Tcl (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-syslog Tcl-syslog is a Tcl interface to the *nix syslog service. It provides a Tcl package that allows Tcl scripts to log messages to syslog. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-syslog/ Man page: http://tcl-syslog.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl-mmap: A POSIX mmap interface for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mmap Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides a Tcl package that allows Tcl scripts to: 1) Memory map files for improved access efficiency; 2) Share memory between related processes; 3) Easily implement cyclic persistent log files. * See the mmap(2) man page. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-mmap/ Man page: http://tcl-mmap.sourceforge.net/ Author: Alexandros Stergiakis On Sep 3, 11:48=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl project: tcl-mmap > > Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides > a Tcl package that allows Tcl scripts to: 1) Memory map files for > improved access efficiency; 2) Share memory between related processes; > 3) Easily implement cyclic persistent log files. > > * See the mmap(2) man page. > Great to see this and the other packages you made. Looking at the manpage it looks a bit misformatted before the usage example. Any specific reason to use GPL for this instead the usual Tcl/MIT/BSD style license used? Michael schlenk wrote: > On Sep 3, 11:48 am, Alexandros Stergiakis <alst...@gmail.com> wrote: >> This is an announcement for a relatively new Tcl project: tcl-mmap >> >> Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides >> a Tcl package that...

tcl-mq: POSIX Message Queues for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mp Tcl-mp is a Tcl interface to POSIX Message Queues*. It provides a Tcl package that allows scripts to create/open/close/unlink multiple parallel message queues, and to send/receive messages synchronously and asynchronously to/from them. * A POSIX message queue is an Inter-Process Communication mechanism available on Linux and some other POSIX-compliant operating systems. It allows to or more processes (or threads) to communicate under the same OS. The messages are buffered by the kernel, which gives them kernel persistency. A message queue can be thought of as a linked list of messages. Threads with adequate permission can put messages onto the queue, and threads with adequuate permission can remove messages from the queue. Each message is assigned a priority by the sender, and the oldest message of highest priority is always retrieved first. Unlike PIPES and FIFOS, no requirement exists that someone be waiting for a message to arrive on a queue, before some process writes a message to that queue. It's not even a requirement for both processes to exist at the same time. Read mq_overview(7) for more details Platform: Linux Home page: http://sourceforge.net/projects/tcl-mp/ Man page: http://tcl-mp.sourceforge.net/ Author: Alexandros Stergiakis alsterg On Sep 3, 11:37=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl pro...

TCL on a cisco 3845 question from a Newbie
Hi, maybe you can give me some answers to my questions: I'm thinking of buying a cisco 3845 to test some TCL scripts - can anybody of you confirm a cisco 3845 is fine for this? Do I need a special IOS version or feature set? The problem to solve is, to use a cisco 3845 as Gateway and execute a TCL script which overwrites the DNIS with the SIP To: number. I hope, you understand at least a bit what I want to do. Thanks in Advance! Markus Ploerer Hi Markus, You may also wish to investigate the Cisco-centric Open Source Initiative Forum: http://sourceforge.net/forum/?group_id=25401 ...

brand new to tcl; newbie question
I am only a couple of days into tcl and XOWiki. I am trying to call a basic function but can't figure out how to call one. proc test {} { return "text to display" } proc content {} { set somevar test() return "$somevar" } How do you call a function? i.e. in "set somevar test()" i want to call test... Thank you. chedderslam wrote: > I am only a couple of days into tcl and XOWiki. I am trying to call a > basic function but can't figure out how to call one. > > proc test {} { > return "text to display" > } > > proc content {} { > set somevar test() > > return "$somevar" > > } > > How do you call a function? > i.e. in "set somevar test()" i want to call test... > > Thank you. set somevar [test] At 2008-04-29 03:13PM, "Bryan Oakley" wrote: > chedderslam wrote: > > I am only a couple of days into tcl and XOWiki. I am trying to call a > > basic function but can't figure out how to call one. > > > > proc test {} { > > return "text to display" > > } > > > > proc content {} { > > set somevar test() > > > > return "$somevar" > > > > } > > > > How do you call a function? > > i.e. in "set somevar test()" i want to call test... > > > > Thank you. > > set somevar [test] You ...

newbie question : call tcl script from C
hi I am relatively new to tcl and have the following problem: I need to call a tcl script from C that takes a Tcl_listObj as an argument and also returns a Tcl_ListObj as a result. I was trying to use Tcl_EvalFile for the purpose but I fail to figure out how to pass a list as an argument. Can somebody please give me an example/reference for implementing such a case? Thanks in advance Raj Hi, "Anis" <anismo@yahoo.com> writes: > I need to call a tcl script from C that takes a Tcl_listObj as an > argument and also returns a Tcl_ListObj as a result. See Tcl_Eval() or...

Newbie question on windows/java/tcl I/O
I have this java CLI which I'm automating tests for in WIN XP cmd-prompt environment with activestates tcl and expect4win I spawn and handle the java process with expect. To catch general exceptions etc i have a catch {} around the whole expect session. The problem is that the catch dont seem to react to the exceptions from the java process. The java cli prints exceptions with System.err.println() Anyone has any ideas as to how the cli should return to trigger catch?? Regards Petter In article <82427ea2.0406100247.516beeff@posting.google.com>, Petter ?sterling <petter6618389@h...

tcl-snmptools: SNMP v1/v2/v3 operations for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-snmptools Tcl-snmptools is a Tcl interface to the Net-SNMP library which provides operations for the management of remote SNMP agents. It supports all the standard SNMP v1/v2/v3 operations: connect, close, get, set, getnext, walk, bulkget, bulkwalk, trap, translate and others. It is currently in a functional state, but more work and testing needs to be done. Home page: http://sourceforge.net/projects/tcl-snmptols/ Man page: http://tcl-snmptols.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

Opening a TCL program from within another TCL program in ANSYS Tcl-Tk
Hi everyone, I have been pulling my hair with this one for a couple of days and still have not found a fix. I'm working within ANSYS Tcl-Tk implementation. I created a Tcl-Tk script that generates a simple window with three buttons. Each button opens another window which is created in a separate Tcl file. The second window have a lot of text entries, variables, procedures, etc. I can open the second Tcl file by itself and everything works as supposed, but when I open it using the button in the first window, it opens but any procedure called by the widgets on the second window are not found... Here's the deal... Since I'm working within the ANSYS implementation of Tcl-Tk, I'm actually using an ANSYS command to open the second window. The command I use is: ### ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/ IBR_CAS.tcl' ### It actually sends a command back to ANSYS telling it to execute a Tcl command... I know this is not pretty but its the only way i was able to make it at least show the window. ############################## #Main Tcl (excerpt): ############################## namespace eval Tools { proc IBRCambpell {} { #source O:/mad_projects_2/ANSYS/Macros/IBR_CAS.tcl ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/ IBR_CAS.tcl' } proc viewManager {} { ans_sendcommand ~eui,'source O:/mad_projects_2/ANSYS/Macros/ ViewManager.tcl' } proc powerAnnotation {} { ans_sendcommand ~eui,'source ...

How Tcl speaks for itself and how Tcl is not spoken for...
Hello It's Friday and... well... Two things about Tcl going through my mind this week, a nice anecdote and a eyebrow-rising thing on Wikipedia: Anecdote: Until three months ago I worked in a scientific institue where I wrote much software in Tcl, especially a big Build and Report System, some tools for automatic checking of coding style and other things. Tcl had a bad reputation there (not because of me... they dropped Tcl before I started there in favour of Joy, then JavaScript and now Python) and besides me, there was only one co-worker who appearantly writes some small Tcl-Scripts to support other researchers in their work. To get completely rid of Tcl, they even started to reimplement all things, I wrote in Tcl in Python just to have it in a language, that most of them know (which is a good decision on the one hand, but on the other hand, I think, it would be better to simply learn Tcl ;-), which made me a little bit sad. Now there is a new collegue who has to maintain some of the things I wrote. Comming from Perl he wasn't exactly enthusiastic when he heard, that he must maintain my old code in such an obscure language.. Two weeks ago, I got mail from him. He's just studying a complex system of scripts that are used for a sandboxed build system for source code which comes from external untrusted source and must be compiled and tested. Of course it's written in Tcl (and some bash-Scripting). He told me, that although he has never looked at Tcl before,...

tcl application with tcl application
Here is another question, I have one tcl-based application A, my co- worker has a tcl-based application B. Now I want to integrate my application A into the application B. After integration, I want to be able to run A's tcl command in B. Assume I can only change A's code, is there any way to do this? On 17 Dez., 07:03, teacupfull business <teacupfull.busin...@gmail.com> wrote: > Here is another question, I have one tcl-based application A, my co- > worker has a tcl-based application B. Now I want to integrate my > application A into the application B. >...

How to compile tcl or encrypt tcl
I use TclPro1.5 to compile my tcl script with tixwish in the Solaris before. But I cannot use the same method in Linux. Why? Is there any utility for me to compile or encrypt the code by using tixwish? The following is the simple code if I use the tixwish: #!/home/albertl/local/bin/tixwish puts "haha" And after using procomp by the TclPro1.5 Error in startup script: The TclPro ByteCode Loader is not available or does not support the correct version while executing "error "The TclPro ByteCode Loader is not available or does not support the correct version"" invoked from within "if {[catch {package require tbcload 1.3} err] == 1} { error "The TclPro ByteCode Loader is not available or does not support the correct version" ...." (file "a.tbc" line 4) The problem seems that tbcload1.3 cannot be found? But tbcload is already there "/home/albertl/local/lib/tbcload1.3" Why? Can anyone tell me? stratus schrieb: > I use TclPro1.5 to compile my tcl script with tixwish in the Solaris before. > But I cannot use the same method in Linux. Why? > > Is there any utility for me to compile or encrypt the code by using tixwish? > Tixwish is just a wish shell with the Tix package baked in. If TclPro does not have a specific bigwish with Tix included your out of luck on that road (but could build your own if you liked). You might have success with freewrap or TDK, don't know for su...

newbie question: how to make tcl share data with another process
how can i run a gawk and tk/tcl process in parallel, with one reading output from the other and vice versa? (yes, this is a newbie question but i can't find an answer i the FAQ. by the way, there are several dead links in the list http://tcl.sourceforge.net/faqs/tcl/#below ). my plan A was: 1) a main shell file touches two files, one for gawk out and one for tcl out 2) the main shell file spawns two sub-process: gawk and tcl 3) sub-processes loop forever reading output of other files, halting when they see "bye" being written by the other then i found this tutorial: http://www2.lib.uchicago.edu/~keith//tcl-course/topics/processes.html and it looked like a better plan B was 1) tcl spawns the gawk process, knows the name of the pipe that talks to gawk 2) tcl and gawk talk to each other via pipes but this code crashes (os/x) saying "pipe illegal command". pipe childread parentwrite pipe parentread childwrite if {[fork] == 0} { # child close $parentwrite close $parentread gets $childread message puts $childwrite "Child: got $message" flush $childwrite } else { # parent close $childread close $childwrite puts $parentwrite "Hey, child!" flush $parentwrite gets $parentread message puts "Parent: Child sez: \"$message\"" } then somewhere else said that pipes are not supported at all under os/x so i'm confused. help? thanks! tim menzies -- Pos...

Newbie Question (Was: Newbie Question...)
Thanks to everyone for all the suggestion. Every one of them has enlightned me a lot. I suppose I will use the "find" subroutine I wrote modifiied as Jugoslav suggested (in a module), or the function proposed by David (the solution proposed by David is far more intuitive and useful than mine). I still have some problem with the PACK function (as suggested by Paul & Richard & Michel), but maybe is because here at work I only have digital visual fortran 6.0 (Mathworks says that is enormously bugged), or maybe because I'm so stupid I've made mistakes again... So I have t...

TCL question
I am trying to split a string into lines. The string contains embedded > new lines and I just want to break it into a list of separate lines, > using the "split' command - page 45 in "Exploring Expect". But it actually splits the string > into separate words, apparently using the space " " character instead > of the "\n". I also tried the "\r" but the effect was no different. > > The command I used was: > split $zzz "\n" > > Thank you, > > > John. JSLEEMAN@stanfordmed.org wrote: > I am trying to split a string into lines. The string contains > embedded >> new lines and I just want to break it into a list of separate lines, >> using the "split' command - page 45 in "Exploring Expect". But it actually splits the string >> into separate words, apparently using the space " " character instead >> of the "\n". I also tried the "\r" but the effect was no different. >> >> The command I used was: >> split $zzz "\n" >> >> Thank you, >> >>> John. > What you describe sounds unusual. If you have a string in "zzz" that is a bunch of characters split by newlines, [split $zzz "\n"] _will_ split on newlines. To wit: tclsh % set zzz "this is\nthree lines\nof text" this is three lines of text tclsh % split...

Newbie question about path failures in a configure script that requires Tcl
Greetings I am trying to install a software package (Rnaviz) that depends on Tcl. The configure script output: checking for Tcl configuration... found /usr/local/lib/tclConfig.sh checking for existence of /usr/local/lib/tclConfig.sh... loading checking for Tcl public headers... /usr/local/include checking for building with threads... no (default) checking how to build libraries... shared checking for build with symbols... no checking how to build libraries... stubs checking for tclsh... configure: error: No tclsh found in PATH: NONE/ bin NONE/bin /usr/local/lib /usr/local/lib/../bi...

newbie to tcl
Hi, I am writing a simulation script for which i have various test scripts which is being set to either 1 or 0 in the main script. so I want to check whether a particular test script is set to 1 or 0 in a foreach loop, how do I do that. I tried by saying foreach i {1 2 3 4..} { if($"testscr$i" == 1} { --- --- } but this isnt working. thanks. Neo a �crit : > > Hi, > I am writing a simulation script for which i have various test scripts > which is being set to either 1 or 0 in the main script. so I want to > check whether a particular test script is set to 1 or 0 in ...

Extending TCL in C with tcl.h - Disabliing [<tcl-cmd>] feature
Hi, TCL has a command execution syntax like this: [<tcl cmd>] Anything inside the 3rd bracket will be executed as a Tcl command by the Tcl interprater. Is there any way I can disable/delete this Tcl construct [ <tcl-cmd>]? In other words, my Tcl interprator should print "[32]" for tcl command puts "[32]" It should not try to treat [] as a special character. Is this any way possible while extending Tcl in C with tcl.h? Thank you, Arijit * arijit79@gmail.com | puts "[32]" | | It should not try to treat [] as a special character. Check out the TCL quoting rules. http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm#M10 http://www.tcl.tk/man/tcl8.4/TclCmd/Tcl.htm#M15 Any of puts {[32]} puts "\[32\]" will do the trick. R' On May 8, 3:14 am, ariji...@gmail.com wrote: > Is there any way I can disable/delete this Tcl construct [ <tcl-cmd>]? By doing this, you would disable the primary functionality of Tcl. I'm certain you could go into the tcl source and stop it - but why not talk about what you are really trying to do. Perhaps someone can give you a better way of doing what you are wanting to do. ...

TCL
Hello, i would like to build TCL/TK as a separate DLL-Library. Can anyone tell me how this can be done with VC 6.0? Best regards, Reinhold "Reinhold.kwauka" <bernd-reinhold.kwauka@t-online.de> wrote: >Hello, > >i would like to build TCL/TK as a separate DLL-Library. Can anyone tell me >how this can be done >with VC 6.0? > >Best regards, >Reinhold > 1) get the source from http://tcl.sourceforge.net/ 2) open a command prompt 3) cd to the win/ subdirectory 4) call vcvars32.bat located in ??\vc98\bin\ of vc6 for wherever you installed it. 5) type @ the prompt: nmake -f makefile.vc -- David Gravereaux <davygrvy@pobox.com> [species: human; planet: earth,milkyway(western spiral arm),alpha sector] Reinhold.kwauka wrote: > Hello, > > i would like to build TCL/TK as a separate DLL-Library. Can anyone tell me > how this can be done > with VC 6.0? > > Best regards, > Reinhold > > Its already done. Just download a binary release for windows and check \Program Files\Tcl\lib for the DLLs and static libraries. ...

Tcl
Hello all. I found on hobbes the afaik latest Tcl for Os/2 v8.35 Is there any newer port, cause i try to update the eggdrop and that says: Your Tcl version is much too old for Eggdrop to use. You should download and compile a more recent version. The most reliable current version is 8.5.X and can be downloaded from ftp://tcl.activestate.com/pub/tcl/tcl8_5/. -- With the best regards from the Netherlands, Tu, "Tellerbop" <Tellerbop@wint.nl>, hai scritto questo in data Wed, 14 Jan 2009 19:11:18 UTC: > Hello all. > > I found on hobbes the afaik latest Tcl for Os/2...

Tcl
Hello, where can I see for tcl syntacs and how-to run a tcl test? Thank You Vittore ___________________________________ Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB http://mail.yahoo.it ---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: ptolemy-hackers-request@ptolemy.eecs.berkeley.edu ...

Web resources about - Newbie Tcl Question - comp.lang.tcl

West Lothian question - Wikipedia, the free encyclopedia
He illustrated his point by pointing out the absurdity of a Member of Parliament for West Lothian being able to vote on matters affecting the ...

World Science Festival Brisbane 2016: Questions abound in learning extravaganza
Are humans on the verge of destroying our planet? Is creativity linked to insanity? And just when are we finally going to be whizzing around ...

Nico Rosberg and Formula One's biggest question ... can he beat Hamilton?
Formula one's biggest question. Can Nico Rosberg beat Lewis Hamilton?

Experts question effectiveness of Xenophon's reforms to foreign investment laws
Nick Xenophon says current foreign investment laws are as clear as mud and weak as water.

Yahoo! Board Seats ‘Perplex’ SunTrust; ‘Fiduciary Duty’ in Question
SunTrust Robinson Humphrey ’s Robert Peck this morning follows up on the announcement by Yahoo! ( YHOO ) this morning that it has appointed two ...

I assume we're dealing with burst photography, so the question is: Why choose this particular instant ...
Everyone was just talking about that wonderful photograph that Christopher Horner captured at a Pittsburgh Pirates baseball game last Saturday. ...

Florida governor kicked off 'Morning Joe' after dodging questions about Trump's latest inflammatory statement ...
Florida Gov. Rick Scott was kicked off of MSNBC's "Morning Joe" on Thursday after he refused to directly answer a question about GOP frontrunner ...

Questions linger after mom says 4-year-old son shot her in truck
Questions linger after mom says 4-year-old son shot her in truck

‘Foolish and Impractical’: Security Experts Question Trump’s Mexico Wall Proposal
Donald Trump’s proposal to build a wall along the southwest border Mexico would decrease delicate bilateral border security cooperation, set ...

Wake up Texas. Houston. It's not a question of if. The question is when.
Willful passivity and political cowardice can be a real and present danger to our lives. Few of us in the Galveston/Houston area will ever forget ...

Resources last updated: 3/13/2016 2:02:46 PM