The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
checking the smallest and largest number subin_bala Shell Programming and Scripting 4 04-24-2008 08:32 AM
Invoice Processing in a Service-Oriented Environment iBot Oracle Updates (RSS) 0 04-18-2008 07:10 PM
plz correct this wannalearn Shell Programming and Scripting 8 04-26-2007 08:56 AM
checking jump sequence number (part2) happyv Shell Programming and Scripting 3 10-19-2006 07:03 AM
sequence number checking nhatch UNIX for Dummies Questions & Answers 1 04-24-2003 03:25 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-29-2007
happyv happyv is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 209
checking invoice number not correct

hello,

I have the following script to check the invoice number is in order or not.
However, it cannot show out the correct information. My expect output show below and I would like to only list out the NOT IN SEQUENCE inovice number (not included "ok")

#!/bin/sh
start=1
for file_number in `ls -1 /appl/appl/archive/client/CACHE/CLIENTINVOICE*[0-9].archived | sort | cut -c 48,49,50,51`
do
if [ $start -eq 1 ] ; then
# this is the first pass of the loop, so we've got nothing to compare
start=0
previous=$file_number
else
# this is not the first pass of the loop
previous=`expr $previous + 1`
echo "comparing $file_number and $previous ... "
if [ $file_number = $previous ] ; then
echo "OK"
else
seqno=`expr $file_number - 1`
echo "CLIENTINVOICE$invoiceno are not in sequence "
fi
fi
previous=$file_number
done


input:
01185
01191
01192
01193
01196
01197
.
.
.

script output:
01190 are not in seq
01195 are not in seq

expect output
01186 are not in seq
01187 are not in seq
01188 are not in seq
01189 are not in seq
01190 are not in seq
01194 are not in seq
01195 are not in seq
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0