Sponsored Content
Full Discussion: Rename files on the fly
Top Forums UNIX for Dummies Questions & Answers Rename files on the fly Post 302095919 by kcor on Sunday 12th of November 2006 12:24:22 PM
Old 11-12-2006
Yeah, i noticed. My main concern was setting up the for loop. That was the gist of my problems. Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to rename files?

:confused: How can i rename a file 'x.log' to 'x_20020512 072909.log' :eek: i'm using perl, with system command from a unix web server, and need to timestamp my logs if the above format (filename _ year month day hr min sec .log) (9 Replies)
Discussion started by: CompuTelSystem
9 Replies

2. Shell Programming and Scripting

rename files

hey all, I have files in the format of ABCD20061101 and ABCDEF20061101 in one directory, I would like to change all ABCD20061101 to ABCDEF20061101 and the problem is if I do a simple pattern match of ABCD, then those ABCDEF20061101 would also... (2 Replies)
Discussion started by: mpang_
2 Replies

3. Shell Programming and Scripting

Moving multiple files and renaming them on the fly

Hi All, Being new to scripting I am facing a new situation. We have an application that generates a file lets say dumpfile for each user under the users home directory when they execute the application. This is quite a huge file and imagine having that for over 40 users on a daily basis. The... (1 Reply)
Discussion started by: daemongk
1 Replies

4. Shell Programming and Scripting

Rename files

Hello, I've a list of file like this img_001 img_22 img_44 and I would rename all with this form photo_0001 photo_0002 photo_0003 photo_0004 suggestions?Thanks to all. (2 Replies)
Discussion started by: cv313x
2 Replies

5. Shell Programming and Scripting

rename files Ax based on strings found in files Bx

Hi, I'm not very experienced in shell scripting and that's probably why I came across the following problem: I do have several hundred pairs of text files (PF00x.spl and PF00x.shd) where the first file (PF00x.spl) needs to be renamed according a string that is included in the second file... (12 Replies)
Discussion started by: inCH
12 Replies

6. Shell Programming and Scripting

Read Files on the Fly

Hi, I am creating files in a folder on the fly with arbritrary names but same extension (say, ".img"). How can I read each filename from the folder through a script. regards Angshuman (2 Replies)
Discussion started by: angshuman_ag
2 Replies

7. Shell Programming and Scripting

Rename files

Hi, I am new to Unix and i have a requirement where i need to write a shell script where i have to loop through various files present in a directory and rename them based on below criteria. Files in the folder are in the following format. _YYYYMMDD.dat] SDL_V1_20100530.dat... (6 Replies)
Discussion started by: bishoo
6 Replies

8. UNIX for Advanced & Expert Users

How to gzip files "on fly" before copying

Hello, I want to gzip some files before copying to remote host. There is no freespace on source host so it needs to be perfomed within one-liner. I tried the following but it didn't work gzip -c -9 all_rvds.xml |ssh targethost "dd of=/tmp/all_rvds.xml.gz" cat all_rvds.xml |gzip -c9 |ssh... (5 Replies)
Discussion started by: urello
5 Replies

9. Shell Programming and Scripting

Script to unzip files and Rename the Output-files

Hi all, I have a many folders with zipped files in them. The zipped files are txt files from different folders. The txt files have the same names. If i try to find . -type f -name "*.zip" -exec cp -R {} /myhome/ZIP \; it fails since the ZIP files from different folders have the same names and... (2 Replies)
Discussion started by: pmkenya
2 Replies

10. Shell Programming and Scripting

SBATCH trinity for multiple files and rename/move the output files

Hey guys, I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output) #!/bin/bash -l #SBATCH -p node #SBATCH -A <projectID> #SBATCH -n 16 #SBATCH -t 7-00:00:00 #SBATCH --mem=128GB #SBATCH --mail-type=ALL... (1 Reply)
Discussion started by: @man
1 Replies
Tcl_Main(3)						      Tcl Library Procedures						       Tcl_Main(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_Main, Tcl_SetMainLoop - main program and event loop definition for Tcl-based applications SYNOPSIS
#include <tcl.h> Tcl_Main(argc, argv, appInitProc) Tcl_SetMainLoop(mainLoopProc) ARGUMENTS
int argc (in) Number of elements in argv. char *argv[] (in) Array of strings containing command-line arguments. Tcl_AppInitProc *appInitProc (in) Address of an application-specific initialization procedure. The value for this argument is usually Tcl_AppInit. Tcl_MainLoopProc *mainLoopProc (in) Address of an application-specific event loop procedure. _________________________________________________________________ DESCRIPTION
Tcl_Main can serve as the main program for Tcl-based shell applications. A "shell application" is a program like tclsh or wish that sup- ports both interactive interpretation of Tcl and evaluation of a script contained in a file given as a command line argument. Tcl_Main is offered as a convenience to developers of shell applications, so they do not have to reproduce all of the code for proper initialization of the Tcl library and interactive shell operation. Other styles of embedding Tcl in an application are not supported by Tcl_Main. Those must be achieved by calling lower level functions in the Tcl library directly. The Tcl_Main function has been offered by the Tcl library since release Tcl 7.4. In older releases of Tcl, the Tcl library itself defined a function main, but that lacks flexibility of embedding style and having a function main in a library (particularly a shared library) causes problems on many systems. Having main in the Tcl library would also make it hard to use Tcl in C++ programs, since C++ programs must have special C++ main functions. Normally each shell application contains a small main function that does nothing but invoke Tcl_Main. Tcl_Main then does all the work of creating and running a tclsh-like application. Tcl_Main is not provided by the public interface of Tcl's stub library. Programs that call Tcl_Main must be linked against the standard Tcl library. Extensions (stub-enabled or not) are not intended to call Tcl_Main. Tcl_Main is not thread-safe. It should only be called by a single master thread of a multi-threaded application. This restriction is not a problem with normal use described above. Tcl_Main and therefore all applications based upon it, like tclsh, use Tcl_GetStdChannel to initialize the standard channels to their default values. See Tcl_StandardChannels for more information. Tcl_Main supports two modes of operation, depending on the values of argc and argv. If the first few arguments in argv match ?-encoding name? fileName, where fileName does not begin with the character -, then fileName is taken to be the name of a file containing a startup script, and name is taken to be the name of the encoding of the contents of that file, which Tcl_Main will attempt to evaluate. Otherwise, Tcl_Main will enter an interactive mode. In either mode, Tcl_Main will define in its master interpreter the Tcl variables argc, argv, argv0, and tcl_interactive, as described in the documentation for tclsh. When it has finished its own initialization, but before it processes commands, Tcl_Main calls the procedure given by the appInitProc argu- ment. This procedure provides a "hook" for the application to perform its own initialization of the interpreter created by Tcl_Main, such as defining application-specific commands. The procedure must have an interface that matches the type Tcl_AppInitProc: typedef int Tcl_AppInitProc(Tcl_Interp *interp); AppInitProc is almost always a pointer to Tcl_AppInit; for more details on this procedure, see the documentation for Tcl_AppInit. When the appInitProc is finished, Tcl_Main enters one of its two modes. If a startup script has been provided, Tcl_Main attempts to evalu- ate it. Otherwise, interactive mode begins with examination of the variable tcl_rcFileName in the master interpreter. If that variable exists and holds the name of a readable file, the contents of that file are evaluated in the master interpreter. Then interactive opera- tions begin, with prompts and command evaluation results written to the standard output channel, and commands read from the standard input channel and then evaluated. The prompts written to the standard output channel may be customized by defining the Tcl variables tcl_prompt1 and tcl_prompt2 as described in the documentation for tclsh. The prompts and command evaluation results are written to the standard output channel only if the Tcl variable tcl_interactive in the master interpreter holds a non-zero integer value. Tcl_SetMainLoop allows setting an event loop procedure to be run. This allows, for example, Tk to be dynamically loaded and set its event loop. The event loop will run following the startup script. If you are in interactive mode, setting the main loop procedure will cause the prompt to become fileevent based and then the loop procedure is called. When the loop procedure returns in interactive mode, interac- tive operation will continue. The main loop procedure must have an interface that matches the type Tcl_MainLoopProc: typedef void Tcl_MainLoopProc(void); Tcl_Main does not return. Normally a program based on Tcl_Main will terminate when the exit command is evaluated. In interactive mode, if an EOF or channel error is encountered on the standard input channel, then Tcl_Main itself will evaluate the exit command after the main loop procedure (if any) returns. In non-interactive mode, after Tcl_Main evaluates the startup script, and the main loop procedure (if any) returns, Tcl_Main will also evaluate the exit command. SEE ALSO
tclsh(1), Tcl_GetStdChannel(3), Tcl_StandardChannels(3), Tcl_AppInit(3), exit(n) KEYWORDS
application-specific initialization, command-line arguments, main program Tcl 8.4 Tcl_Main(3)
All times are GMT -4. The time now is 12:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy