The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
help - script can check jump sequence? happyv Shell Programming and Scripting 10 11-01-2008 08:59 PM
checking the smallest and largest number subin_bala Shell Programming and Scripting 4 04-24-2008 07:32 AM
Sequence number generation on a key column sbasetty Shell Programming and Scripting 6 03-27-2008 12:09 PM
checking invoice number not correct happyv Shell Programming and Scripting 8 03-29-2007 05:07 AM
sequence number checking nhatch UNIX for Dummies Questions & Answers 1 04-24-2003 02:25 PM

Closed Thread
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
  #1 (permalink)  
Old 10-19-2006
happyv happyv is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 209
checking jump sequence number (part2)

The following script have some bug...can you all help me:

#!/bin/sh
start=1
for file_number in `ls -1 /appl/CH_DATA/archive/list1/CACHE/CDBACKUPFILEJohn*.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
echo "file names $file_number are not in sequence "
fi
fi
previous=$file_number
done


For the above, I have problem to list CD*.archived in directory, because of I have same filename with *.archived and *_bup.archived.

1 - I just want to list out CD*.archived
2 - I have alot filename like CDBACKUPFILEJohn*, CDBACKUPFILEMARRY*, CDBACKUPFILEPETER*, etc. Can I put all name into the name.txt and
the script can read the name.txt and put into the scrip like CDBACKUPFILE$name?

Thanks!!
  #2 (permalink)  
Old 10-19-2006
justsam
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
If you dont want _bup.archived, use grep -v option in the ls command .


ls -1 /appl/CH_DATA/archive/list1/CACHE/CDBACKUPFILEJohn*.archived | grep -v _bup.archived | sort | cut -c 48,49,50,51
  #3 (permalink)  
Old 10-19-2006
happyv happyv is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 209
Quote:
Originally Posted by justsam
If you dont want _bup.archived, use grep -v option in the ls command .


ls -1 /appl/CH_DATA/archive/list1/CACHE/CDBACKUPFILEJohn*.archived | grep -v _bup.archived | sort | cut -c 48,49,50,51

Thank's it work! How about the filename "John" can I read from the list.txt (because of over 300 different filename) and check the seq?
  #4 (permalink)  
Old 10-19-2006
happyv happyv is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 209
I have a list.txt (over 300 name) like:

john
marry
peter
annie

can my script read it and put into like "CDBACKUPFILEjohn*.archived", "CDBACKUPFILEmarry*.archived" to check jump seq number?
Closed Thread

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 08:55 PM.


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