Extract data using a reference


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extract data using a reference
# 1  
Old 08-01-2017
Extract data using a reference

Gents,

If there the possibility can to extract data using a reference from other file.

input.txt ( big file which contends all data
output.txt ( data extracted )
selection.txt ( information to extract the data

Example

In file input.txt there is big data each record have 56 lines like this.. then for example i will like to extract the record 39441.00 49781.00 so this record will be in file selection.txt. to extract all information (56 lines).

Code:
% VE464 V4.1.06
% Normal Acq
% SL            : 39441.00
% SN            : 49781.00
% SI            : 1
% StackNb       : 1
% FleetNb       : 10
% DsdNb         : 5
% SweepCounter  : 05376
% Sweep  Type   : b2=[CUSTOM -]
% Sweep Status  : 1
% Drive         : 75
% Gps Status    : $GPGGA,032536.00,2200.91436042,N,05046.52631472,E,5,16,0.6,155.203,M,-32.418,M,1.0,0000*6
% GNGSA         : $GNGSA,A,3,72,71,73,83,74,85,65,84,,,,,1.3,0.6,1.1*25
% GNGST         : $GNGST,032536.00,0.002,0.051,0.047,7.6,0.051,0.048,0.015*40
% GPZDA         : $GPZDA,032536.01,28,07,2017,00,00*6F
% PTNL         : $PTNL,GGK,032536.00,072817,2200.91436042,N,05046.52631472,E,12,16,1.3,EHT122.786,M*42
% TB            : 17/07/28 03:25:24:580000 [12324580000 microsec]
% QC type        : window = 1000 ms , normalized
% Time Inhibit  : 11
% EXTENDED TIME STATUS :
%     phase               warnings                overloads
%         force   Gv  Gs  masse pist. plaque
%Time         dist        1 2 3 1 2 3 1 2 3 4 5 6 F P M V E
0.5     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1.0     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1.5     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2.0     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2.5     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3.0     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3.5     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4.0     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4.5     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5.0     0   0   0 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5.5     1  71   7 128 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6.0     1  76   7  44  15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6.5    -1  76   6  33  21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7.0     0  73   7  32  17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7.5     0  72   6  38  19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8.0     0  73   6  42  22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8.5     0  74   6  43  31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9.0    -1  74   6  39  24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9.5     1  73   6  44  26 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10.0    0  74   7  41  23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10.5    1  72   7  45  21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11.0    1  75   9  49  24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11.5    2  76   8  51  26 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12.0    0   0   0  59  24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
% time end of prev sweep to up    :       230 ms
% pad up                          : 17/07/28 03:24:57:239
% pad down                        : 17/07/28 03:25:16:861
% time up to down                 :     19622 ms
% time down to pressure switch ON :      1220 ms
% time down to ready              :      1230 ms
% time down to sweep              :      7735 ms
% sweep length                    :     12000 ms

The purpose is to keep the same format like the input file.

I hope some one can help me with this if is possible
# 2  
Old 08-01-2017
Any attempts / ideas / thoughts from your side (as you promised earlier)?
# 3  
Old 08-01-2017
Hi RudiC.

Smilie No.

I can extract part of the text. But no all .
Is this possible ,?
# 4  
Old 08-02-2017
Quote:
Originally Posted by jiam912
Hi RudiC.

Smilie No.

I can extract part of the text. But no all .
Is this possible ,?
With the results you have seen from the other 90 threads you have started, you know this is possible. We are here to help you learn how to do projects like this on your own; not to act as your unpaid programming staff.

As with all shell script questions submitted to this forum, please tell us what operating system and shell you're using.

Clearly explain the format of the selection.txt file. (Is there ever more than one record to be selected? If so, what separates SL values in selection.txt?)

Are there any separators between the 56 line records in input.txt? (If so, what are the separators?)

And, most importantly, show us what you have done and where you are stuck.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with merge data with a reference sequence

I have two input file.: File 1 is a large reference sequence (A large Fasta sequence); File 1 (is a file which first line is the header description and line other ">" is its corresponding word and counting from 1 till end of file); >Data_1 ASWDADAQTWQQGSAAAAASDAFAFA . . File 2 is... (31 Replies)
Discussion started by: cpp_beginner
31 Replies

2. Shell Programming and Scripting

Compare data with reference from other file

Gents, Please can you help with this. I have a big file (file2) which contends many records increment every 25 rows ( column 1 ). Then I have other file as reference (file1).. column 1 to 11. I want to compare that all values in file2 (column 2 to 12.) match with values in... (2 Replies)
Discussion started by: jiam912
2 Replies

3. UNIX for Dummies Questions & Answers

Extract text in sed using back reference

i have a text 20 21 22 23 24 25 26 i want to get 22 using sed back reference. I have used sed 's/{6}\(..\).*/\1/' but, it does not work. I am missing something somewhere. Please help. (5 Replies)
Discussion started by: gotamp
5 Replies

4. Shell Programming and Scripting

Replace a value using a reference data from other file

Gents, Can you please help me to solve this case In my input file I have a values in column 49 which always need to be one, but sometimes the system create a value 2, in this case I need to go to search in the original file and replace the values in the row where the value 2 is and in the... (6 Replies)
Discussion started by: jiam912
6 Replies

5. Shell Programming and Scripting

awk -- Extract data from html within multiple tags as reference

Hi, I'm trying to get some data from an html file, but the problem is before it can extract the information I have multiple patterns that need to be passed through. https://www.unix.com/shell-programming-scripting/150711-extract-data-awk-html-files.html Is a similar problem. The only... (5 Replies)
Discussion started by: counfhou
5 Replies

6. Shell Programming and Scripting

Help with checking reference data frequency count

reference data GHTAS QER CC N input data NNWQERPROEGHTASTTTGHTASNCC Desired output GHTAS 2 QER 1 CC 1 N 3 (2 Replies)
Discussion started by: perl_beginner
2 Replies

7. Shell Programming and Scripting

Reference data check for delete

Dear All, I have a master file - Master.txt 100|ABC 200|CED 500|XYZ 800|POL I have a reference file - Ref.txt 200 800 What is desired.. Check for all those records in reference file matching with those within master file and then delete those records from Master file So, at end,... (1 Reply)
Discussion started by: sureshg_sampat
1 Replies

8. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

9. Shell Programming and Scripting

How to extract data from BNC xml with reference brackets?

I have data like the following pattern: <change date="2000-01-09" who="#OUCS">Updated all catrefs</change> <change date="2000-01-08" who="#OUCS">Manually updated tagcounts, titlestmt, and title in source</change> <change date="1999-09-13" who="#UCREL">POS codes revised for BNC-2; header... (14 Replies)
Discussion started by: Johnivy
14 Replies
Login or Register to Ask a Question