Sponsored Content
Top Forums Shell Programming and Scripting Renaming a file use another file as a sequence calling a shl Post 302410205 by rechever on Monday 5th of April 2010 09:30:54 AM
Old 04-05-2010
using a file with a sequence to rename another one

Thank you this is helpful, but still not working this is what I got
the first part works the ftp I get the 04051000.DSB file,
now I want to rename that file with the result of
Code:
 
get $UpLoadFileName
cat -n inner
file_seq=$( < eftseq.dat)
echo $file_seq "file_seq"
file2=eft$(expr $file_seq + 1).dat
echo $file2 "file2"
file3=eftsql$(expr $file_seq + 1).dat
echo $file3 "file3"
quit
!EOF

Results

Code:
 
quote pass gvf1!3Mk
cd orgs
cd "Financial Aid"
cd MIIS
cd 0910
cd FTP
get 04051000.DSB
cat -n inner
file_seq=+ + No such file or directory
rzpeftf[143]: eftseq.dat: cannot open
rzpeftf[143]: eftseq.dat: cannot open
+ shl pain
rzpeftf[163]: shl: not found

when I ran these commands on the command line it works
Code:
 
file_seq=$( < eftseq.dat)
echo $file_seq "file_seq"
file2=eft$(expr $file_seq + 1).dat
echo $file2 "file2"
file3=eftsql$(expr $file_seq + 1).dat
echo $file3 "file3"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shl script capture a file

need to be able to capture a file with the following conditions: The filenames are, for example, 3526_332840.dat, where 3526 is constant, and 332840 is a sequential number which is always a couple hundred greater than the previous day's file. I want to be able to change this script to acoomplish... (1 Reply)
Discussion started by: rechever
1 Replies

2. UNIX for Dummies Questions & Answers

renaming file from text in a file

Hello all, I've read a couple different posts on this subject but couldn't quite get what I'm trying to do to work. I have a file and the last line always ends with the text below (without the "s), except the number 294 will be different each time. I want to rename this file to the number that... (6 Replies)
Discussion started by: isonic1
6 Replies

3. Shell Programming and Scripting

Reading a file (one record) in a SHL script

I am trying to read a file in a shl script (only one record) and stored in a variable file_number I got the following read -u $BANNER_HOME/xxxxxxx/misc/EFTSQL.dat file_number file_number2 = $file_number + 1 echo $file_number2 > $BANNER_HOME/xxxxxx/misc/EFTSQL.dat EOF It is not working... (2 Replies)
Discussion started by: rechever
2 Replies

4. Shell Programming and Scripting

File renaming from list of names contained in another file

I have to rename a large number of files so that the name of each file corresponds to a code number that is given side by side in a list (textfile). The list contains in column A the filename of the actual files to be renamed and in column B the name (a client code, 9 digits) that has to be... (7 Replies)
Discussion started by: netfreighter
7 Replies

5. Shell Programming and Scripting

last file in a directory in a shl script

I want to capture a last file in a directory in a shl scrip Cd to the directory $last ls -1 *the_bills.dat* | tail -1 This is not problem, but I need to copy that file to another directory, but in order to be able to copy to that directory, I need to su in unix, I am sure my sistem... (2 Replies)
Discussion started by: rechever
2 Replies

6. Shell Programming and Scripting

Need to decrypt a file in a directory (SHL script)

I need to decrypt a file in a directory, I need to write a shl scrip & cron job How I find the files in the directory: the file is like this: dailypayments_sfs_payment_201011151800.dat -d The decrypt command: gpg -o dailypayments_sfs_payment_201011151800.dat -d 20101115 (the date... (7 Replies)
Discussion started by: rechever
7 Replies

7. Shell Programming and Scripting

Problems coping a file in a shl script

I have the following in a shl script: SCRIPT_PATH="/u01/app/banner/test/skid/plus/"; FILE_PATH="/nfs/mercury/u03/banner/test/skid/log"; LIST_FILE_PATH="/u01/banjobs/TEST"; SCRIPT_NAME="szpcal1.sql"; FILE_NAME='new_applicant_list'; I want to copy the file FILE_NAME to LIST_FILE_PATH ... (10 Replies)
Discussion started by: rechever
10 Replies

8. Shell Programming and Scripting

Renaming file and check for the renamed file existence

Hi Am trying to move a file from one name to another When I do "ls" to check for the moved filename I can see the file but when I try the same with a script am unable.. I think am doing some pretty silly error.. please help.. toMove=`ls | grep -E "partition.+"` mv $toMove partition._org... (7 Replies)
Discussion started by: Priya Amaresh
7 Replies

9. Shell Programming and Scripting

Inserting IDs from a text file into a sequence alignment file

Hi, I have one file with one column and several hundred entries File1: NA1 NA2 NA3And now I need to run a command within a mapping aligner tool to insert these sample names into a sequence alignment file (SAM) such that they look like this @RG ID:Library1 SM:NA1 PL:Illumina ... (7 Replies)
Discussion started by: nans
7 Replies

10. Shell Programming and Scripting

Renaming a file with sequence number

Hi team, I need a script for renaming a file with sequence number. script get a file from one directory, /home/billing/Cmm/sms/sms_tmp, append sequence no at the end of file name and move a file to other directory, /home/billing/Cmm/sms/. Actual file is cdr201508271527, and file after... (10 Replies)
Discussion started by: mfaizan40
10 Replies
shl(1)							      General Commands Manual							    shl(1)

NAME
shl - shell layer manager SYNOPSIS
DESCRIPTION
provides a means for interacting with more than one shell from a single terminal by using shell layers. A layer is a shell that is bound to a virtual device. The virtual device can be manipulated like an actual terminal by using and (see stty(1) and ioctl(2)). Each layer has its own process group ID. The user controls these layers by using the commands described below. The current layer is the layer that can receive input from the keyboard. Other layers attempting to read from the keyboard are blocked. Output from multiple layers is multiplexed onto the terminal. To block the output of a layer when it is not current, the option can be set within the layer. The character (set to if NUL) is used to switch control to from a layer. has its own prompt, to distinguish it from a layer. Definitions A is a sequence of characters delimited by a space, tab, or new-line character. Only the first eight characters are significant. When provided as an argument to the or commands, name cannot be of the form n or where n is a decimal number. Commands The following commands can be issued from the prompt level. Any unique prefix is accepted. Create a layer called name and make it the current layer. If no argument is given, a layer is created with a name of the form where n is the num- ber of the next available slot in an internal table. Future references to this layer can be made with or without the paren- theses. If name is followed by a command, that command is executed in the layer instead of a shell. If is the first argu- ment, a ``login shell'' is created in the layer. The shell prompt variable is set to the name of the layer followed by a space. Rename the layer oldname, calling it newname. If oldname is not specified, the current layer name is changed. Invoke a sub-shell and execute command. If no command is given, a shell is executed according to the environment variable. For each name, block the output of the corresponding layer when it is not the current layer. This is equivalent to setting the option within the layer. For each name, delete the corresponding layer. All processes in the process group of the layer are sent the signal (see signal(5)). Print the syntax of the commands. For each name, list the layer name and its process group. The option produces a ps(1)-like listing. If no arguments are given, information is presented for all existing layers. Change the status of the layer referred to by name to that of current layer. If no argument is given, the last existing current layer is changed. Change the status of the previous current layer to that of current layer. For each name, do not block the output of the corresponding layer when it is not the current layer. This is equivalent to setting the option within the layer. Exit All layers are sent the signal. name Change the status of the layer referred to by name to that of current layer. Any unique prefix is accepted. WARNINGS
Commands The behavior of the and commands is not guaranteed when the SHELL environment variable is set to (for csh(1)) or (for ksh(1)), or when the shell saves and restores the tty state (defined in termio(7)) before and after each command is invoked interactively from that shell. For both and the or options of can be used from within the layer to block or unblock the output of that layer. Ptydaemon For to function properly, the process must be running on the system. If your system has been installed with the Desktop HP-UX product, then will not be started by default. In order to start this daemon, change from a "0" to a "1" in the file. The system must either be rebooted for this change to take effect, or you can manually start this daemon by typing : Note that will also be disabled if the DesktopConfig.LITECONFIG fileset has been installed on the system, or if the system administrator has previously run the utility and selected the from within any of screens. does not support long user and group names on the current release, HP-UX 11i V3. FILES
Variable containing path name of the shell to use (default is SEE ALSO
sh(1), stty(1), ioctl(2), signal(5). STANDARDS CONFORMANCE
shl(1)
All times are GMT -4. The time now is 10:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy