Sponsored Content
Top Forums Shell Programming and Scripting print out missing files in a sequence Post 302616273 by avatar_007 on Friday 30th of March 2012 07:44:13 PM
Old 03-30-2012
print out missing files in a sequence

Hello all,

I have several directories with a sequence of files like this
Code:
IM-0001-0001.dcm
IM-0001-0002.dcm
IM-0001-0003.dcm
IM-0001-0004.dcm
IM-0001-0005.dcm

I would like to print out the name of the file that is missing.

I currently have the following ineffecient way to do this and wondering if you would suggest me a better way to do this in multiple directories.

Code:
ls -1 *.dcm | awk -F"-" '{print $3}' > ori.txt

Code:
[]$ cat ori.txt 
0001.dcm
0002.dcm
0004.dcm
0005.dcm

Create another list with all files that are supposed to be there

Code:
[]$ cat main.txt 
0001.dcm
0002.dcm
0003.dcm
0004.dcm
0005.dcm

Code:
[]$ diff ori.txt main.txt 
2a3
> 0003.dcm

It would be good if I could display the full name of the missing file.

Thanks,

Moderator's Comments:
Mod Comment Please, use code tags!

Last edited by Scrutinizer; 03-31-2012 at 04:29 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scan two files and print values missing

Dear Experts, Have been seraching this forum from this morning for my query but dint find hence posting it her... Basically i have two input files BSS and MSS which has a unique string , hence i hav tried and seperated the text to compare frm both files .. Any my present input files look like... (6 Replies)
Discussion started by: shaliniyadav
6 Replies

2. Programming

find the missing sequence in hash perl

Dear Perl's Users, Could anyone help me how to solve my problem. I have data with details below. TTY NAME SEQUENCES U-0 UNIX 0 U-1 UNIX 1 U-2 UNIX 2 <-- From 2 jump to 5 U-5 UNIX 5 U-6 UNIX 6 <-- From 6 jump to 20 U-20 ... (2 Replies)
Discussion started by: askari
2 Replies

3. Shell Programming and Scripting

Perl : print the sequence number without missing number

Dear Perl users, I need your help to solve my problem below. I want to print the sequence number without missing number within the range. E.g. my sequence number : 1 2 3 4 5 6 7 8 11 12 13 14 my desired output: 1 -8 , 11-14 my code below but still problem with the result: 1 - 14 1 -... (2 Replies)
Discussion started by: mandai
2 Replies

4. Shell Programming and Scripting

How to take the missing sequence Number?

Am using unix aix KSH... I have the files called MMRR0106.DAT MMRR0206.DAT MMRR0406.DAT MMRR0506.DAT MMRR0806.DAT .... ... MMRR3006.DAT MMRR0207.DAT These files are in one dircetory /venky ? I want the output like this ? Missing files are : MMRR0306.DAT MMRR0606.DAT... (7 Replies)
Discussion started by: Venkatesh1
7 Replies

5. Shell Programming and Scripting

How to check missing sequence?

I want to listed files every hours and check the missing sequence my file format is CV.020220131430.txt CV.020220131440.txt CV.020220131450.txt CV.ddmmyyhhm.txt how to check if i have missing files in sequence .. thanks (3 Replies)
Discussion started by: before4
3 Replies

6. Shell Programming and Scripting

Case script to get missing sequence among files

I want to use case statement to find the range of missing sequence in my directory which it has some few ( dat & DAT ) files my directory /home/arm/my_folder/20130428 contains : f01_201304280000.DAT f01_201304280001.DAT f01_201304280003.DAT f02_201304280000.dat f02_201304280002.dat... (2 Replies)
Discussion started by: arm
2 Replies

7. Shell Programming and Scripting

Find missing sequence

Hi, I need to find out the missing sequence from a list. However the issue is there is not a fixed start and end, it depends on the generation of files. For eg, it might start with 4000 and end with 9000. Based on this, I need a script which greps the start and end sequence from the... (3 Replies)
Discussion started by: danish0909
3 Replies

8. Shell Programming and Scripting

Identifying Missing File Sequence

Hi, I have a file which contains few columns and the first column has the file names, and I would like to identify the missing file sequence number form the file and would copy to another file. My files has data in below format. APKRISPSIN320131231201319_0983,1,54,125,... (5 Replies)
Discussion started by: rramkrishnas
5 Replies

9. Shell Programming and Scripting

Find the missing sequence

Dear all i am having file with max 24 entries. i want to find which sequence is missing file is like this df00231587.dat df01231587.dat df03231587.dat df05231587.dat . . . df23231587.dat the changing seq is 00-23,so i would like to find out which seq is missing like in above... (13 Replies)
Discussion started by: sagar_1986
13 Replies

10. Shell Programming and Scripting

To check the missing file based on sequence number.

Hi All, I have a requirement that i need to list only the missing sequences with a unix script. For Example: Input: FILE_001.txt FILE_002.txt FILE_005.txt FILE_006.txt FILE_008.txt FILE_009.txt FILE_010.txt FILE_014.txt Output: FILE_003.txt FILE_004.txt FILE_007.txt FILE_011.txt... (5 Replies)
Discussion started by: Arun1992
5 Replies
gdcminfo(1)							       GDCM							       gdcminfo(1)

NAME
gdcminfo - Display meta info about the input DICOM file. SYNOPSIS
gdcminfo [options] file-in DESCRIPTION
The gdcminfo command line program takes as input a DICOM file, or a directory and process it to extract meta- information about the DICOM file processed. PARAMETERS
file-in DICOM input filename options options -r --recursive recursive. -d --check-deflated check if file is proper deflated syntax. --resources-path Resources path. --md5sum Compute md5sum of Pixel Data attribute value. --check-compression check the encapsulated stream compression (lossless/lossy). general options -h --help print this help text and exit -v --version print version information and exit -V --verbose verbose mode (warning+error). -W --warning warning mode, print warning information -E --error error mode, print error information -D --debug debug mode, print debug information environment variable GDCM_RESOURCES_PATH path pointing to resources files (Part3.xml, ...) Simple usage gdcmData Using data from gdcmData: $ gdcminfo gdcmData/012345.002.050.dcm MediaStorage is 1.2.840.10008.5.1.4.1.1.4 [MR Image Storage] NumberOfDimensions: 2 Dimensions: (256,256) Origin: (-85,21.6,108.7) Spacing: (0.664062,0.664062,1.5) DirectionCosines: (1,0,0,0,0,-1) Rescale Intercept/Slope: (0,1) SamplesPerPixel :1 BitsAllocated :16 BitsStored :16 HighBit :15 PixelRepresentation:1 Orientation Label: CORONAL Davie Clunie datasets: Using data from David Clunie datasets: $ gdcminfo BRTUM001.dcm MediaStorage is 1.2.840.10008.5.1.4.1.1.4.1 [Enhanced MR Image Storage] NumberOfDimensions: 3 Dimensions: (256,256,15) Origin: (40,-105,105) Spacing: (0.820312,0.820312,6) DirectionCosines: (0,1,0,0,0,-1) Rescale Intercept/Slope: (0,1) SamplesPerPixel :1 BitsAllocated :16 BitsStored :16 HighBit :15 PixelRepresentation:1 Orientation Label: SAGITTAL Checking the md5sum of the Pixel Data After compressing a DICOM file (see gdcmconv) using a lossless compression algorithm, it is fairly easy to compare the two files for differences at DICOM attribute level. However one operation is slightly easier to do: how to make sure the compression was actually lossless ? In this case one could use the --md5sum operation. Take an uncompressed DICOM image file: $ gdcminfo --md5sum SIEMENS_ImageLocationUN.dcm The tool return: 0621954acd5815e0b4f7b65fcc6506b1 Now compress this file: $ gdcmconv --jpegls SIEMENS_ImageLocationUN.dcm lossless_compressed.dcm and then check again the md5sum: $ gdcminfo --md5sum lossless_compressed.dcm The tool return: 0621954acd5815e0b4f7b65fcc6506b1 Checking if Pixel Data is lossless In come environment one wish to check whether or not the DICOM file is lossless or not. It is fairly easy to do that in most cases. Only in two occasion this is not clear from the sole DICOM Attribute. When the Transfer Syntax is JPEG 2000 Image Compression (1.2.840.10008.1.2.4.91) and when the Transfer Syntax is JPEG-LS Lossy (Near-Lossless) Image Compression (1.2.840.10008.1.2.4.81). In this case, the only solution is to open the Pixel Data element, read the specific JPEG header and check whether or not the JPEG transformation was lossless or not: $ gdcminfo --check-compression gdcmData/MAROTECH_CT_JP2Lossy.dcm The tool returns: 'Encapsulated Stream was found to be: lossy' SEE ALSO
gdcmdump(1), gdcmraw(1), gdcmconv(1) COPYRIGHT
Copyright (c) 2006-2011 Mathieu Malaterre Version 2.2.0 Tue Feb 5 2013 gdcminfo(1)
All times are GMT -4. The time now is 01:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy