![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| How to compare a field value of a same column? | gobinath | Shell Programming and Scripting | 6 | 05-06-2009 01:39 AM |
| Compare 2 files for a single column and output differences | samit_9999 | UNIX for Dummies Questions & Answers | 1 | 04-23-2008 12:02 PM |
| compare the column from 3 files and merge that line | ganesh_mak | Shell Programming and Scripting | 8 | 04-14-2008 07:56 AM |
| awk compare column between 2 files | phamp008 | Shell Programming and Scripting | 3 | 01-18-2008 12:24 AM |
| I need to extract last column of a file and compare the values | vukkusila | Shell Programming and Scripting | 4 | 08-04-2007 11:21 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Compare Column value from Two Different Files
Hi, I need help to write a korn shell script to
1. Check and compare the first file contains single record from the /scp/inbox directory against the badpnt.dat file from the pnt/badfiles directory contains multiple records based on the fam_id column value start at position 38 to 47 from the record below. Here is an example of the record from the file in both directories: PNT0220060503081122003700100000091049000005629001005146417001407712SFirstname Lastname 2. If fam_id is matched then move current file from the /scp/inbox directory into the pnt/badfiles directory. If not then continue the normal process This is what I have so far pntcnt=`ls -l /$ROOTDIR/scp/inbox/badpnt | grep "PNT." | wc -l` if [[ $pntcnt -gt 0 ]] then ls /$ROOTDIR/scp/inbox/badpnt | grep "PNT." > /$ROOTDIR/scp/inbox/badpnt/pntprocess.dat pntcnt=`wc -l /$ROOTDIR/scp/inbox/badpnt/pntprocess.dat|awk '{print $1}` sleep 10 curcnt=1 while (( $curcnt <= $pntcnt )) do badpnt_chck=`head -$curcnt /$ROOTDIR/scp/inbox/badpnt/pntprocess.dat | tail -1` fi pntcnt1=`ls -l /$ROOTDIR/scp/inbox | grep "PNT." | wc -l` if [[ $pntcnt1 -gt 0 ]] then ls /$ROOTDIR/scp/inbox | grep "PNT." > /$ROOTDIR/scp/inbox/pntprocess.dat pntcnt1=`wc -l /$ROOTDIR/scp/inbox/pntprocess.dat|awk '{print $1}` sleep 10 curcnt1=1 do inbox_chck=`head -$curcnt1 /$ROOTDIR/scp/inbox/pntprocess.dat | tail -1` fi Thank You Last edited by hanie123; 03-29-2007 at 10:45 AM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|