Fix script to get missing information


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fix script to get missing information
# 8  
Old 12-01-2014
Dear RudiC.
Thanks a lot for your help. it works fine but list all values which contents the status 14 and 98.
The work here is to get verify that the last index
Code:
 ind=substr($0,26,1)

has a value of 1, if not them the script should list
Example
Code:
A         69373.0 19385.013 3  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0    90 10398  
A         69373.0 19385.013 6  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0    90 10398  
A         69373.0 19385.023 3 75   1   4163770 76 45 26 269519.7 2861274.8  -6.6    90 103 1  
A         69373.0 19385.023 6 75   1  -3132671 78 43 26 269527.1 2861262.8   3.8    90 103 1

Here we see that
Code:
status=substr($0,91,2

in index 2 is = 1, then we should don't list the status 98 for this
Code:
 substr($0, 11, 24-11)

.

but in this example:
Code:
A         69387.0 20105.01310 75   1  -3122871 77 43 22 284941.6 2870579.3  26.6  1097 103 1  
A         69387.0 20105.013 3 75   1  -4173371 75 64 27 284930.0 2870570.5  26.6  1097 103 1  
A         69387.0 20105.02310 75   0   0 0 0 0  0  0  0      0.0       0.0   0.0  1097 10314  
A         69387.0 20105.023 3 75   0   0 0 0 0  0  0  0      0.0       0.0   0.0  1097 10314

has the last index have status = 14, then it should appear in the output list

In the same case of that all index have values 98 or 14 the list should list all.
example

Code:
A         69577.0 19489.01410  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   215 10498  
A         69577.0 19489.014 7  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   215 10498  
A         69577.0 19489.02410  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   215 10498  
A         69577.0 19489.024 7  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   215 10498  
A         69577.0 19489.03410  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   215 10498  
A         69577.0 19489.034 7  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   215 10498  
A         69577.0 19489.04410  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   215 10498  
A         69577.0 19489.044 7  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   215 10498  
A         69577.0 19529.01410  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   275 10498  
A         69577.0 19529.014 7  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   275 10498  
A         69577.0 19529.02410  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   275 10498  
A         69577.0 19529.024 7  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0   275 10498

Here all index from 1 to 4 have status = 98,

I have a big list and if you notice the value
Code:
substr($0, 11, 24-11)

, is repeated 2 times = index 1, then again 2 times and the index increase to = 2, and ++

The goal here is to verify if the last index have code = 1, if not the case we need to list the errors.

For that from the input I should get this only.

Code:
6936919969 index 2 has 2 times status 14
6937919401 index 2 has 2 times status 14
6937919401 index 3 has 2 times status 14
6938720105 index 2 has 2 times status 14
6957719489 index 1 has 2 times status 98
6957719489 index 2 has 2 times status 98
6957719489 index 3 has 2 times status 98
6957719489 index 4 has 2 times status 98
6957919489 index 1 has 2 times status 98
6957919489 index 2 has 2 times status 98
6958119529 index 2 has 2 times status 14
6958320209 index 2 has 2 times status 14
6958719737 index 2 has 2 times status 14
6958920185 index 2 has 2 times status 14
6959120009 index 1 has 1 times status 98
6959320089 index 1 has 1 times status 98

Code:
A         69593.0 20089.01410 75   1  -3112772 76 56 27 282018.5 2874825.8  17.6  1102 104 1   
A         69593.0 20089.014 7  0   0   0 0 0 0  0  0  0      0.0       0.0   0.0  1102 10498

In this case as there is one index and have one value as status 98 , then I list it.

Thanks a lot for your time and help .
# 9  
Old 12-01-2014
Sorry, I don't get it.
This User Gave Thanks to RudiC For This Post:
# 10  
Old 12-01-2014
Thanks for all your help.

One thing more here

How I can do something to get only the values which have the same status all time (only 14 and 98)..

example for the input list I should get only:

6957719489 all records have status 98
6957919489 all records have status 98

Thanks
# 11  
Old 12-01-2014
But you have that:
Code:
                                 if ((brr[3] == 14) || (brr[3] == 98))
                                         print brr[1]" index "brr[2]" has "key[i]" times status " brr[3]

There are ONLY lines with status 14 / 98 in the output.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Missing information in output file

Gents, Using the following code i am able to output the information i need, but some of the strings are not complete due to the separator : used.. Kindly can u help me to get all string after the first : Example in the output file column 16 i should get 17/11/25 03:43:51:732000 but i... (8 Replies)
Discussion started by: jiam912
8 Replies

2. Shell Programming and Scripting

My script failed and can't fix it ?

Hi , I'd like to give you a little bit idea about my script which is used to get any generated file from remote server using ftp session then organized those file into directories based on their date ( at the end I supposed to have 1 months directories 20130401 20130402 ....20130430 ,... (27 Replies)
Discussion started by: arm
27 Replies

3. Shell Programming and Scripting

How to fix my IMDB Script

Hello, I am using IMDB bot file for my movie site.. But I get this message like this---Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in... (2 Replies)
Discussion started by: lg2013
2 Replies

4. UNIX for Dummies Questions & Answers

Please help to fix awk script

Good morning, fellows. I would need to ask for your help in editing my awk script. Here is the original version: BEGIN { printf ("CRYST1 200.000 200.000 200.000 90.00 90.00 90.00 P 1 1\n") maxatoms=1000 natom=0 found_struct = 0 found_bond = 0 } { if( NF == 5 ) { foundff=0 natom++... (9 Replies)
Discussion started by: snysmumrik
9 Replies

5. Windows & DOS: Issues & Discussions

Fix script error (%%n)

Hi, I'm currently tinkering with a script that uses the for command to process all *.gif files in the current folder. I marked the spot where it exits out with an error by adding a "pause" The error message given is: convert.exe: unable to open image `%x': No such file or directory @... (2 Replies)
Discussion started by: pasc
2 Replies

6. Shell Programming and Scripting

Fix CSV file with column missing quotes

I have a CSV file that is missing quotes around a column that contains text with commas. Example: Column1, Column2, Column3, Column4, Column5, Column6 Data1, Data2, Data3, Data, 4, Data5, Data6 Data1, Data3, Data3, Data, text, 4, Data5, Data6 I think the easiest way for me to fix this is to... (2 Replies)
Discussion started by: EmptyH
2 Replies

7. Shell Programming and Scripting

how to fix this awk script?

i have a log file while looks like this ++ user_a blabla blabla nas_b blabla user_d this is a user_a junk line another junk line user_c nas_m blabla ++ basically most of the lines contain a "user" keywords, and the rest of the lines do not have "user" at all. So I have the... (17 Replies)
Discussion started by: fedora
17 Replies

8. Shell Programming and Scripting

fix a problem in this script

z=9 i=0 h=02 min=55 while do cat /home/barmecha/test | grep $h:$min >> /home/barmecha/file1 min=`expr $min + 1` if ; then h=`expr $h + 1` fi i=`expr $i + 1` done i have a log file with time wise log in it, this script help me to pull out logs of the give time interval...but the... (8 Replies)
Discussion started by: abhishek27
8 Replies

9. Linux

missing in script

Hi , I am trying to make this change work in my script but its not working.The idea is to grep for "CREATE VIEW" and then change view name from orig to VW_orig. but the problem comes when there is no schema prefix to the view name . the code I am using is #!/bin/ksh... (5 Replies)
Discussion started by: capri_drm
5 Replies
Login or Register to Ask a Question