Finding missing sequential file names


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Finding missing sequential file names
# 1  
Old 07-03-2008
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  
Old 07-03-2008
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  
Old 07-03-2008
Try this ....:
Assume that the file names are file1 file2 file3....file10

Code:
seq -f "file%g" 1 10  | xargs ls -l | grep -v '^-'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to print missing and keep sequential ordering if not found

The below awk in bold will look for the ids in file1 in $2 of file2 and if they match print the line in file2. If an id is missing or not found in file2 (like BMPR2 in line4 of file1) I can not figure out how to add it to them to the lines in the output as missing in $3 following the same format.... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Shell Programming and Scripting

Finding a string in a list of files, print file names

I'm interested in writing a report script using BASH that searches all of the files in a particular directory for a keyword and printing a list of files containing this string... In fact this reporting script would have searches for multiple keywords, so I'm interested in making multiple... (2 Replies)
Discussion started by: chemscripter904
2 Replies

3. Shell Programming and Scripting

Finding size of files with spaces in their file names

I am running a UNIX script to get unused files and their sizes from the server. The issue is arising due to the spaces present in the filename/folder names.Due to this the du -k command doesn't work properly.But I need to calculate the size of all files including the ones which have spaces in them.... (4 Replies)
Discussion started by: INNSAV1
4 Replies

4. Shell Programming and Scripting

Shell Scripts (Renaming file names with sequential numbers)

Hi there, Firstly, I have no experience with shell scripts so would really appreciate some help. I have the following shell script that is causing some problems: moveit() { && set -x if then DOUBLE_DELIVERY=$(grep... (6 Replies)
Discussion started by: thebeno
6 Replies

5. Shell Programming and Scripting

Finding File Names Ending In 3 Random Numerical Characters

Hi, I have a series of files (upwards of 500) the filename format is as follows CC10-1234P1999.WGS84.p190 each of this files is in a directory named for the file but excluding the extension. Now the last three numeric characters, in this case 999, can be anything from 001 to 999, I need to... (3 Replies)
Discussion started by: roche.j.mike
3 Replies

6. Shell Programming and Scripting

Finding tags in file names using csh

I have the following script and want to check if in each $f there exists either a "drw" or "smp" tag in the file name. How can I do it? For example npt06-32x24drw has the "drw" tag npt06-32x24smp has the "smp" tag npt06-32x24 no "drw" or "smp" tag found #!/bin/csh set iarg = 0... (0 Replies)
Discussion started by: kristinu
0 Replies

7. Shell Programming and Scripting

finding missing items in file

I have a need to compare 2 files, then print results to file. Need to find items from file2 that are not found in file 1. thanks in advance! example: file 1: abcde=12 fffff=6 bbbb=35 file2: abcde=12 fffff=6 bbbb=35 ccccc=10 kkkkk=45 (8 Replies)
Discussion started by: discostu
8 Replies

8. Shell Programming and Scripting

Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names

I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves. Also, the script should only move a file from /exports to... (6 Replies)
Discussion started by: nikosey
6 Replies

9. UNIX for Advanced & Expert Users

Finding which file is missing

I was hoping someone ould help me with the following. I have 2 files in a directory FILEA and FILEB. i am running a process on these 2 files but before the process can run both FILEA and FILEB need to be present. If one or both the files are missing i need to know what file(s) is(are)... (10 Replies)
Discussion started by: SAMZ
10 Replies

10. Programming

Reading special characters while converting sequential file to line sequential

We have to convert a sequential file to a 80 char line sequential file (HP UX platform).The sequential file contains special characters. which after conversion of the file to line sequential are getting coverted into "new line" or "tab" and file is getting distorted. Is there any way to read these... (2 Replies)
Discussion started by: Rajeshsu
2 Replies
Login or Register to Ask a Question