How to takes missing files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to takes missing files
# 1  
Old 08-16-2012
How to takes missing files

Hi Am using unix aix

I have a group of files in File1
For ex:-

Code:
Vi file1
A0405
A0605
A0805

When i tried using awk command am getting an error as No space
Code:
a=`awk 'NF < 1 {next;} p && p != $1 { for( i = p; i < $1; i++ )print i; } {p = $1 + 1 }' file2`



Error message:-
Code:
+ + awk NF < 1 {next;} p && p != $1 { for( i = p; i < $1; i++ )print i;}{p = $1 
+ 1 } file2
aa04[3]: no space



outputs must be:
Missing:-
Code:
A0505
A0705

can anyone help me..........



Moderator's Comments:
Mod Comment Last reminder to use code tags.

Last edited by zaxxon; 08-16-2012 at 03:18 AM.. Reason: code tags
# 2  
Old 08-16-2012
what you are trying to do please explain
# 3  
Old 08-16-2012
Hi raj_saini20

In file1 i have a lots of files starting with alphabet A....
For ex A0405 (04 is date and 05 is month )
when i give inputs to awk command i need the outputs what are the files missing k
if i used this awk command to only having number inside the file1 ..
for ex
Code:
vi file1
     01
     04

am getting the output
Code:
 02
 03

But when i have the files like A0405 etc...
Am getting error message as mentioned above...
In the above ex i have mentioned three filename in files1 file
wants the results as
Code:
A0505
A0705


Last edited by zaxxon; 08-16-2012 at 03:19 AM.. Reason: code tags
# 4  
Old 08-16-2012
try this

Code:
awk 'NF < 1 {next;} p && p != $1 { for( i = p; i < substr($1,2,2)+0; i++ )printf "A%.2d",i;print x } {p = substr($1,2,2) + 1;x=substr($1,4,2) }' file1

# 5  
Old 08-16-2012
Thanks raj..
But i tried didnt get the results ..
i got output only
-------
R0
-------
My files will be in format AssR0405
# 6  
Old 08-16-2012
but i checked on HP-UX its working with output
Code:
A0505
A0705

for your sample file1
# 7  
Old 08-16-2012
AM using AIX.
Am getting the output as
---------
R0
--------

---------- Post updated at 04:10 AM ---------- Previous update was at 02:29 AM ----------

HI all,
When i tried using this command..
a=`awk 'NF < 1 {next;} p && p != $1 { for( i = p; i < substr($1,5,2)+0; i++ )pri
ntf "A%.2d",i;print x } {p = substr($1,5,2) + 1;x=substr($1,4,2) }' file2`
echo "The missing files are $a "

i got as output:
-------------------------------
The missing files are A03R0
A05A06A07A08A09A10A11A12A13A14A15A16A17A18A19A20A21A22A23A24A25A26A27R0
-------------------
But i wants the output like this ..
------------------
AssR0308
AssR0508
....
...
AssR2708
-----------

vi file2
AssR0208
AssR0408
AssR2808
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Finding largest files takes too long

Good evening. because the folder has thousand of files it takes too long and have some trouble to get the largest files and then compress files or delete it, for instance find . -size +10000000c -exec ls -ld {} \; |sort -k5n | grep -v .gz The above commad took an hour and i have to cancel... (10 Replies)
Discussion started by: alexcol
10 Replies

2. Shell Programming and Scripting

Get the missing dependency from two files

#cat hwlock-full.dep libx11-6 >= 1.4.4 libz1 >= 1.2.7 libtinfo5 >= 5.9 libxcb1 >= 1.8.1 numactl >= 2.0.8+rc4 libpixman-1-0 >= 0.29.2 libxml2 >= 2.7.8 libxext6 >= 1.3.1 libxrender1 >= 0.9.7 libfreetype6 >= 2.4.9 libxcb-render0 >= 1.8.1 libcairo2 >= 1.12.14 libc6 >= 2.15 libxcb-shm0... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

3. UNIX for Advanced & Expert Users

How to takes the missing files in ascending order

Hi am using unix aix we have a lots of files which comes from server and fetch in one directory. the files will be in the format as File name as : ------------- pprr0103 (01 as date and 03 as month) pprr0203 pprr0603 ... ... pprr3103 pprr0304 Outputs:- Missing files as... (2 Replies)
Discussion started by: Venkatesh1
2 Replies

4. Shell Programming and Scripting

How to takes the missing files?

Hi all , am using unix aix I have a files in one directory.. my files as in format qqss0607.ddd.. (06 is date 07 is month) how to check the missing dates .... can anyone tell me... (9 Replies)
Discussion started by: Venkatesh1
9 Replies

5. Shell Programming and Scripting

How to take the missing files

Hi all , am using unix ksh I have a lots of files in /prb directory in the format as .. .. .. .. MMRR0607.DAT_2012 MMRR0707.DAT_2012 MMRR0907.DAT_2012 MMRR1107.DAT_2012 ... .. MMRR3107.DAT_2012 MMRR0208.DAT_2012 .. I need the output as Missing files are:- MMRR0807.DAT_2012 (note... (4 Replies)
Discussion started by: Venkatesh1
4 Replies

6. Shell Programming and Scripting

Need a shell script which takes two inputs and copy the files from one directory to other

Hi, I am using solari 10 OS which is having bash shell. I need a shell script which takes user home directory and name of the file or directory as a input and based on that copy the files accordingly to the other directory. example:I hava a machine1 which is having some files in a... (8 Replies)
Discussion started by: muraliinfy04
8 Replies

7. Shell Programming and Scripting

Report missing files

Hello I need to check various directories for the existence of files. If a file or more are missing I need to display it: e.g files in a dir: data_file.11032300.Z data_file.11032301.Z data_file.11032302.Z data_file.11032303.Z data_file.11032304.Z data_file.11032305.Z... (11 Replies)
Discussion started by: drbiloukos
11 Replies

8. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

9. Shell Programming and Scripting

echo and then cp the missing files

Hi.... I have two files abc.txt and xyz.txt. I want to echo and copy files from abc.txt to xyz.txt, which are not in xyz but present in abc.txt. Both of these files are in same directory. Please provide code with while or for loop.... :) (3 Replies)
Discussion started by: tushar_tus
3 Replies

10. UNIX for Dummies Questions & Answers

files missing

a few of some live payroll files have been deleted / missing ... i've restored last nites backup ... what could be the possibilities of this strange occurance ... users have menus to work on and use these live files ... we run an aix box with a ksh shell. Where do I start ?? Thanks (4 Replies)
Discussion started by: cubicle^dweller
4 Replies
Login or Register to Ask a Question