Sponsored Content
Full Discussion: File Format in TCL
Top Forums UNIX for Advanced & Expert Users File Format in TCL Post 302530213 by mail2leo on Monday 13th of June 2011 09:16:22 AM
Old 06-13-2011
File Format in TCL

Hi,

Can anyone please guide me in writing a TCL script. I want to have a procedure to recreate an existing file and backup its copy and rename it by time of the updates are made.

Eg:
I have file xyz.tcl (which on recreation is saved as xyz_11jan_15_30_11.tcl)

So when I do
Code:
% ls
xyz.tcl
xyz_11jan_15_30_11.tcl {last modified and saved time}

Thanks in advance

Last edited by fpmurphy; 06-13-2011 at 10:23 AM.. Reason: code tags please! English fixed up to make it readable.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File Handler in TCL

Hai , I Have Some x.txt file in which has the following data x.txt HI, How Are u r u fine /home/Sanju/samp.html /root/Sanju/design/sample now in tcl i have the following script set fp while { >= 0 } { puts $line ... (1 Reply)
Discussion started by: sanjustudy
1 Replies

2. UNIX for Advanced & Expert Users

Convert UTF8 Format file to ANSI format

:) Hi i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error Function i used it as $ iconv -f UTF8 -t ANSI filename Error iam getting is NOT Supported UTF8 to ANSI please some help me out on this.........Let me... (1 Reply)
Discussion started by: rajreddy
1 Replies

3. UNIX for Dummies Questions & Answers

Convert UTF8 Format file to ANSI format

:confused: Hi i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error Function i used it as $ iconv -f UTF8 -t ANSI filename Error iam getting is NOT Supported UTF8 to ANSI please some help me out on... (9 Replies)
Discussion started by: rajreddy
9 Replies

4. UNIX for Dummies Questions & Answers

Reading line from file - TCL

I Have output of ps -ef in file. while reading from file, it reads one word but i want to read the full line. Is there any way to set IFS in TCL as we set in Shell. Thanks Ajay Kumar (2 Replies)
Discussion started by: aju_kup
2 Replies

5. UNIX for Dummies Questions & Answers

To convert multi format file to a readable ascii format

Hi I have a file which has ascii , binary, binary decimal coded,decimal & hexadecimal data with lot of special characters (like öƒ.ƒ.„İİ¡Š·œƒ.„İİ¡Š· ) in it. I want to standardize the file into ASCII format & later use that as source . Can any one suggest a way a logic to convert such... (5 Replies)
Discussion started by: gaur.deepti
5 Replies

6. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

7. Programming

Parsing a text file in Tcl

Hi all, I need to parse through a text file searching for a specific string, then after I find this string read in remaining data off the line to a variable. I've tried various things and can't seem to get any to work. Any help would be much appreciated. (2 Replies)
Discussion started by: caboose57
2 Replies

8. Programming

TCL reading file

This is the code i have to read and display each line every time. please let me know the bug in this.. am not getting the output set fp set file_data close $fp set data foreach line $data { puts $data } content of abc.txt is ... (1 Reply)
Discussion started by: Syed Imran
1 Replies

9. Programming

File handling in TCL

Hi, I have n number of files in a directory with extension .PGM i need to store the full path name in a variable and only the file name with extension in another variable. Each time i'll be using the next file name for manipulation. Please help me out to do this using TCL thanks (1 Reply)
Discussion started by: Syed Imran
1 Replies

10. Shell Programming and Scripting

Need to call tcl function from other file !!

Hi, Can a function written in tcl in some other file be called in unix scripts ? Like this ? This is my code now--- shell.sh: #!/bin/bash tclsh snmpv2-conf-sam.tcl $SERVER $NODESYSIP $SPASSWD but i need this in a different way like , without having a .tcl file i want the... (2 Replies)
Discussion started by: giri_luck
2 Replies
source(1T)						       Tcl Built-In Commands							source(1T)

__________________________________________________________________________________________________________________________________________________

NAME
source - Evaluate a file or resource as a Tcl script SYNOPSIS
source fileName source -rsrc resourceName ?fileName? source -rsrcid resourceId ?fileName? _________________________________________________________________ DESCRIPTION
This command takes the contents of the specified file or resource and passes it to the Tcl interpreter as a text script. The return value from source is the return value of the last command executed in the script. If an error occurs in evaluating the contents of the script then the source command will return that error. If a return command is invoked from within the script then the remainder of the file will be skipped and the source command will return normally with the result from the return command. The end-of-file character for files is '32' (^Z) for all platforms. The source command will read files up to this character. This | restriction does not exist for the read or gets commands, allowing for files containing code and data segments (scripted documents). If | you require a ``^Z'' in code for string comparison, you can use ``32'' or ``u001a'', which will be safely substituted by the Tcl inter- | preter into ``^Z''. The -rsrc and -rsrcid forms of this command are only available on Macintosh computers. These versions of the command allow you to source a script from a TEXT resource. You may specify what TEXT resource to source by either name or id. By default Tcl searches all open resource files, which include the current application and any loaded C extensions. Alternatively, you may specify the fileName where the TEXT resource can be found. EXAMPLE
Run the script in the file foo.tcl and then the script in the file bar.tcl: source foo.tcl source bar.tcl Alternatively: foreach scriptFile {foo.tcl bar.tcl} { source $scriptFile } SEE ALSO
file(1T), cd(1T), info(1T) KEYWORDS
file, script ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTcl | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tcl is available on http://opensolaris.org. Tcl source(1T)
All times are GMT -4. The time now is 10:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy