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
Finding which file is missing SAMZ UNIX for Advanced & Expert Users 10 06-25-2008 08:30 AM
Finding files with names that have a real number greater then difined. harmonwood Shell Programming and Scripting 2 11-09-2007 10:28 AM
Reading special characters while converting sequential file to line sequential Rajeshsu High Level Programming 2 07-10-2006 02:38 PM
how to find capital letter names in a file without finding words at start of sentence kev269 Shell Programming and Scripting 1 04-10-2006 09:35 PM
inserting uniq sequential numbers at the start of the file jingi1234 UNIX for Dummies Questions & Answers 7 11-19-2005 06:42 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 07-02-2008
Julolidine Julolidine is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 1
Finding missing sequential file names

So, I've got a ton of files that I want to go through (ie something like 300,000), and they're all labeled sequentially. However I'm not 100% positive that they are all there.

Is there any way of running through a sequence of numbers, checking if the file is in the folder, if not appending it to a file so I can figure out if any are missing?
  #2 (permalink)  
Old 07-02-2008
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
Lets see if i have understood you correctly:

The files you have are called:

file1x
file2x
file3x
...

but maybe there are missing numbers which you want to find. Correct?

If so, the following example should do the trick:

Code:
#! /bin/ksh

typeset -i iMinNum=1
typeset -i iMaxNum=9
typeset -i iWork=0
typeset    fLog=./mylogfile

(( iWork = iMinNum ))
while [ $iWork -le $iMaxNum ] ; do
     if [ ! -f ./file${iWork}x ] ; then
          print - "File file${iWork}x is missing" >> $fLog
     fi
     (( iWork += 1 ))
done
I hope this helps.

bakunin
  #3 (permalink)  
Old 07-02-2008
dennis.jacob dennis.jacob is offline Forum Advisor  
dj - the student
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 592
Try this ....:
Assume that the file names are file1 file2 file3....file10

Code:
seq -f "file%g" 1 10  | xargs ls -l | grep -v '^-'
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 06:44 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