Find the missing file and print


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find the missing file and print
# 1  
Old 10-28-2013
Find the missing file and print

Hi ,

i will be getting 24 files for one day with a formate like 20131028_01 - 20131028_24 kind of ,i am trying to write a shell script to count the number of files and if the count is not equal to 24 print the missing files names

Code:
 for A in `seq 0 23`; do ls *20131024_`printf "%02d" $A`*; done

this gives me a complete list but i just want the missing files any help would be thank full
# 2  
Old 10-28-2013
Instead of ls, use [ (aka test) to check for the existence of the file. If the test fails, then print the name.

Regards,
Alister
# 3  
Old 10-28-2013
can you show me the usage
# 4  
Old 10-28-2013
Read man test or check your shell's manual page (ksh and bash, for example, have a builtin version that they document).

Regards,
Alister
This User Gave Thanks to alister For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find list of missing files based on the file format?

Hi All, In the file names we have dates. Based on the file format given by the user, if any file is not existed for a particular date with in a given interval we should consider that file is missing. I have the below files in the directory /bin/daily/voda_files. ... (9 Replies)
Discussion started by: nalu
9 Replies

2. Shell Programming and Scripting

Find columns in a file based on header and print to new file

Hello, I have to fish out some specific columns from a file based on the header value. I have the list of columns I need in a different file. I thought I could read in the list of headers I need, # file with header names of required columns in required order headers_file=$2 # read contents... (11 Replies)
Discussion started by: LMHmedchem
11 Replies

3. Shell Programming and Scripting

Print Missing Header Name from File.

HI Guys, I have file A.txt ID,L1,L2,L3,L4 1A,2a,33a,44b,55c 2A,10a,14a,15b,16c File B.txt ID L1 L4 L5 Output:- ID,L1,L4,L5 (2 Replies)
Discussion started by: pareshkp
2 Replies

4. Shell Programming and Scripting

How to find a missing file sequence using shell scripting?

Hey guys, I want the below files to be processed with the help of BASH so that i will be able to find the missing file names : PP01674520141228X.gz PP01674620141228X.gz PP01674820141228X.gz PP01674920141228X.gz PP01675420141228X.gz PP01675520141228X.gz PP01676020141228X.gz . . . .... (4 Replies)
Discussion started by: TANUJ
4 Replies

5. Shell Programming and Scripting

Print a line where missing!!

Hi, I have a file whihc looks like file_1 100 200 file_2 200 300 file_4 400 500 as the file_3 is missing so I want to replace it by file_3 0 0 the final output would look like file_1 100 200 file_2 200 300 file_3 0 0 file_4 400 500 Any help is highly appreciated. Regards, (1 Reply)
Discussion started by: begin_2013
1 Replies

6. Shell Programming and Scripting

How to find the Missing date inside the FILE?

Hi am using Unix AIX Ksh have a FILE CAT FILE 08/02/2013 16/02/2013 18/02/2013 I need the Outputs as Missing date are 09/02/2013 to 15/02/2013,17/02/2013 can anyone help me !!! (1 Reply)
Discussion started by: Venkatesh1
1 Replies

7. Shell Programming and Scripting

find: missing argument to `-exec' while redirecting using find in perl

Hi Friends, Please help me to sort out this problem, I am running this in centos o/s and whenever I run this script I am getting "find: missing argument to `-exec' " but when I run the same code in the command line I didn't find any problem. I am using perl script to run this ... (2 Replies)
Discussion started by: ramkumarselvam
2 Replies

8. Shell Programming and Scripting

need to print the missing lines in 1 file from 1 file via script

Hi, I am writting a script which will take all the files present in 2 directories. (the 2 directories have the same files with same name but some different content) i need 2 compare 2 files and then copy the contents of file1 to file2. the contents which are missing in file1 and nothing from... (8 Replies)
Discussion started by: dazdseg
8 Replies

9. UNIX for Dummies Questions & Answers

find locked files, print file path, unlock file

using OS X and the Terminal, I'd like to find all locked files in a specified directory, unlock them, and print a list of those files that were unlocked how can I do this? I'm familiar with chflags nouchg for unlocking one file but not familiar with unix enough to do what I'd like. Thanks! (0 Replies)
Discussion started by: alternapop
0 Replies

10. Shell Programming and Scripting

find a file and print its size

I have a directory, /local/test/ under this directory is many subdirectories, each subdir has about 70 files, the 70 files are always the same names. I want to print to the screen the size of fileabc.txt in each of the subdirectories. I cannot seem to work with pipe and splats * because there are... (3 Replies)
Discussion started by: ajp7701
3 Replies
Login or Register to Ask a Question