![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Accessing variables of one shell script in another shell script | rsendhilmani | Shell Programming and Scripting | 2 | 03-17-2009 01:17 AM |
| To call/execute a shell script from a shell script | konark | UNIX for Dummies Questions & Answers | 1 | 10-26-2007 06:16 PM |
| How to pass a parameter from one Shell-script to another Shell-script | subodhbansal | Shell Programming and Scripting | 2 | 09-22-2007 06:19 AM |
| How to Run a shell script from Perl script in Parent shell? | hifake | Shell Programming and Scripting | 16 | 08-28-2007 09:42 PM |
| Have a shell script call another shell script and exit | heprox | Shell Programming and Scripting | 2 | 11-20-2006 08:17 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Shell Script Help!
Hi, being very new to Korn Shell Scripting I am hoping that someone here can help me. I want to compare file name in scp/inbox directory to file name stored inside a file in pnt/compare directory.
Hi, being very new to Korn Shell Scripting I am hoping that someone here can help me. I want to compare file name in scp/inbox directory to file name stored inside a file in pnt/compare directory. 1. Copy the first file name from the scp/inbox directory and insert into the pntcompare.dat. Then exit program. 2. Otherwise, if there is a file name pntcompare.dat in /pnt/compare directory then capture the first file name from the scp/inbox directory and compare to the file name’s information stored inside the pntcompare.dat in /pnt/compare directory. 3. If they matched then remove the current file from the /scp/inbox directory to pnt/badfiles directory 4. Then create a badpnt.dat file and store the record information from file in /scp/inbox directory.. 5. Next, remove the pntcompare.dat file from /pnt/compare directory. 6. Also remove the touch file (inputloop.touch) from Home directory. 7. If they not matched then remove contents in the pntcompare.dat then exit. Here is an example of the file name pnt.20070327083828.000000066 contains a single record with this information PNT0220060503081122003700100000091049000005629001005146417001407712SFirstname Lastname Here is what I can come up so far, please help. file=`/$ROOTDIR/pnt/compare -name 'pntcompare.dat' -print` if [ -z $file ] then pntcnt=`ls -l /$ROOTDIR/scp/inbox | grep "PNT." | wc -l` if [[ $pntcnt1 -gt 0 ]] then ls /$ROOTDIR/scp/inbox | grep "PNT." > /$ROOTDIR/pnt/compare/pntcompare.dat pntcnt=`wc -l /$ROOTDIR/scp/inbox/pntcompare.dat|awk '{print $1}` curcnt=1 do filename=`head -$curcnt /$ROOTDIR/pnt/compare/pntcompare.dat | tail -1` exit else Please help!!! Thanks Last edited by hanie123; 03-29-2007 at 12:57 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|