![]() |
|
|
|||||||
| Home | Forums | Register | Rules & FAQ | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
Other UNIX.COM Threads You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read files from folder and then call another script | girishnn | Shell Programming and Scripting | 3 | 11-06-2007 02:53 PM |
| Help!! Need script to read files and add values by lines... | dhuertas | Shell Programming and Scripting | 3 | 09-15-2007 08:14 PM |
| help writing script to read files names | technett | Shell Programming and Scripting | 2 | 04-26-2005 01:24 PM |
| help with cshell script to read 1 or more lex files | homerj546 | Shell Programming and Scripting | 1 | 04-18-2004 07:01 AM |
| Script with read/write Files | steiner | Shell Programming and Scripting | 5 | 07-25-2003 07:46 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
How to read the content of the files in unix script
Hi I need help below is my textfile format look like
PO Nbr Ln Item Number Description Qty Order Order Date Due Date Status Reply ID Reply Date Reply Qty P304802 1 K0220040 TSX-3225 C 16.367900 MHz 320379 07/01/2008 29/01/2008 REQ OP304802 02/02/2008 190000 P304802 2 K0220040 TSX-3225 C 16.367900 MHz 0 07/01/2008 29/01/2008 REQ OP304802 04/02/2008 130379 I need to check in my unix script (a) each POnbr must be unique (b) one POnbr must be one Item Number (c) the Qty Order must be tally with Reply Qty and below is my unix script set DATE=`date '+%y%m%d%H%M%S'` #set mfgdb="crp3" set mfgdb="prod" set file="TMREPLY" set epmhome="/home/int/${mfgdb}/oed" set datfile="etth009.csv" #set shellhome="/u4/home/it/itjob/batch" #set shellname="bat_crp3" set shellhome="/u4/home/it/itjob/batch" set shellname="bat_prod" set stat=0 echo "------------------------------------" date ### file check (receive) ### echo "### Check error file exist ###" file ${epmhome}/receive/${datfile}* set stat=${status} if (${stat} != 0) then echo "No Error File Found at Receive" else echo "Error File Found at Receive" goto END_OF_PROCESS echo "OK: `date '+%T'`" endif RECEIVE_LOOP: ### File check at receive folder ### echo "### File check at receive ###" file ${epmhome}/receive/${file}* set stat=${status} if ({$stat} != 0) then echo "OK: `date '+%T'`" echo "No Data at Receive folder" goto NOMAL_END endif echo "OK: `date '+%T'`" echo "### Check error file exist ###" file ${epmhome}/receive/${datfile}* set stat=${status} if (${stat} != 0) then echo "No Error File Found at Receive" else echo "Error File Found at Receive" goto END_OF_PROCESS echo "Error File Found: `date '+%T'`" endif ### filename get ### echo "### File load ###" cd ${epmhome}/receive set getfile=`ls ${file}* | head -1` #set loadfile=`echo $getfile:r` #echo "loadfilename="${loadfile} ### Copy File to archive ### echo "### Copy file to archive folder ###" cp ${epmhome}/receive/${getfile} ${epmhome}/archive/ ### Send out email ### echo "### Send e mail ###" uuencode ${epmhome}/receive/${getfile} ${getfile}| mailx -s ETTH_REPLY_Data twloh@epsontoyocom.com ### Change File Name ### echo "### Move File name to etth009.csv ###" mv ${epmhome}/receive/${getfile} ${epmhome}/receive/${datfile} set stat=${status} if ({$stat} != 0) then echo "Move ERROR" goto END_OF_PROCESS endif echo "OK: `date '+%T'`" ### MFG/Pro CIM load process ### echo "### Reply format CIM Load ###" ${shellhome}/${shellname} "ETTH2" set stat=${status} if (${stat} != 0) then echo "MFG/Prod Load Error" goto END_OF_PROCESS endif echo "OK: `date '+%T'`" echo "----------- RECEVE_LOOP ------------" goto RECEIVE_LOOP ### Nomal End ### NOMAL_END: echo "### Nomal End ###" set stat=0 echo "*-----------------------------------" exit {$stat} ### End of process ### END_OF_PROCESS: set stat=1 echo "#-----------------------------------" exit {$stat} Please help me to check the validation in the unix script |
|||
| Google UNIX.COM |
| Forum Sponsor | ||
|
|