shl script capture a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shl script capture a file
# 1  
Old 05-12-2009
Bug 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 what I want

Can somebody explain what this does. (how I can change this to accomplish what I want?)

#Determine if there is a file to process
ls 3987*.dat > /dev/null 2>&1

if [ $? != 0 ]
then
exit
fi

for i in 3987*.dat
do


# Capture just the file sequence number
fseqno=`print $i | sed 's/.*_//' | sed 's/.dat//' `

cd $SOFTPATH/data/finaid/idoc
echo $i `date` > idochd1.lst

cp $i idoc.dat

cd $SOFTPATH/bin

cp $i idoc.dat

cd $SOFTPATH/bin

# Load file into tables
cd $SOFTPATH/script
sqlplus / @$SOFTPATH/script/rypidoc_loadcss_run.sql $fseqno
==============
# 2  
Old 05-13-2009
It is not clear what you want - give us example expected output. Also there seem to be logic errors and other issues in the script you presented.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

set -x within script and capture as a file

Okay, I've been working on a script for providing information on the progress of a backgrounded ditto command. Thanks to google and a lot of searching I've resolved all but one very odd error. At this point, I want to use xtrace (set -x) to try to uncover the issue. I have found several examples... (2 Replies)
Discussion started by: reid
2 Replies

2. 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

3. 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

4. Shell Programming and Scripting

looking for help on script to capture file permission.

Hi Guys, I'm a DBA and need help on shell scripting. My Oracle Database is sitting on HP-UX machine. Anyone has a script that can spool out permission of all oracle binary files in the below directory: /opt/ora10g/oracle/ Format to be spooled out : chmod <exisiting permission> filename... (10 Replies)
Discussion started by: ciaciachew
10 Replies

5. Shell Programming and Scripting

gzip and encrypted in a shl script

After I move the file to a directory, I need to gzip and encrypted. I never do this in a shl script, I do it from the command line and it works.. cd /home/nelnet spinel:/home/nelnet$ gpg -e 2010_11_07_05_11_xxxxxx_bills.dat.gz `/home/nelnet/.gnupg/gpg.conf' `/home/nelnet/.gnupg/gpg.conf'... (3 Replies)
Discussion started by: rechever
3 Replies

6. 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

7. Shell Programming and Scripting

This code works in the command line but not in a shl script

When I run this code from the command line works spinel.middlebury.edu:/u02/sct/banner/bandev2/middlebury/shl:DEV2$ ls ef* eftseq.dat spinel.middlebury.edu:/u02/sct/banner/bandev2/middlebury/shl:DEV2$ file_seq=$( < eftseq.dat) ... (1 Reply)
Discussion started by: rechever
1 Replies

8. Shell Programming and Scripting

Renaming a file use another file as a sequence calling a shl

have this shl that will FTP a file from the a directory in windows to UNIX, It get the name of the file stored in this variable $UpLoadFileName then put in the local directory LocalDir="${MPATH}/xxxxx/dat_files" that part seems to be working, but then I need to take that file and rename, I am using... (3 Replies)
Discussion started by: rechever
3 Replies

9. 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

10. Shell Programming and Scripting

Capture Shell Script Output To A File

Hi, I am running a shell script called dbProcess.sh which performs shutdown and startup of various Oracle instances we have.At the time of execution the script produces the following output to the command line window $./dbProcess.sh stop #### Run Details ###### Hostname : server-hop-1... (4 Replies)
Discussion started by: rajan_san
4 Replies
Login or Register to Ask a Question