Sponsored Content
Top Forums Shell Programming and Scripting Extract data using a reference Post 303001319 by jiam912 on Tuesday 1st of August 2017 03:12:39 PM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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

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

7. 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

8. 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

9. 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
netmasks(4)							   File Formats 						       netmasks(4)

NAME
netmasks - network mask database SYNOPSIS
/etc/inet/netmasks /etc/netmasks DESCRIPTION
The netmasks file contains network masks used to implement IP subnetting. It supports both standard subnetting as specified in RFC-950 and variable length subnetting as specified in RFC-1519. When using standard subnetting there should be a single line for each network that is subnetted in this file with the network number, any number of SPACE or TAB characters, and the network mask to use on that network. Network numbers and masks may be specified in the conventional IP `.' (dot) notation (like IP host addresses, but with zeroes for the host part). For example, 128.32.0.0 255.255.255.0 can be used to specify that the Class B network 128.32.0.0 should have eight bits of subnet field and eight bits of host field, in addition to the standard sixteen bits in the network field. When using variable length subnetting, the format is identical. However, there should be a line for each subnet with the first field being the subnet and the second field being the netmask that applies to that subnet. The users of the database, such as ifconfig(1M), perform a lookup to find the longest possible matching mask. It is possible to combine the RFC-950 and RFC-1519 form of subnet masks in the net- masks file. For example, 128.32.0.0 255.255.255.0 128.32.27.0 255.255.255.240 128.32.27.16 255.255.255.240 128.32.27.32 255.255.255.240 128.32.27.48 255.255.255.240 128.32.27.64 255.255.255.240 128.32.27.80 255.255.255.240 128.32.27.96 255.255.255.240 128.32.27.112 255.255.255.240 128.32.27.128 255.255.255.240 128.32.27.144 255.255.255.240 128.32.27.160 255.255.255.240 128.32.27.176 255.255.255.240 128.32.27.192 255.255.255.240 128.32.27.208 255.255.255.240 128.32.27.224 255.255.255.240 128.32.27.240 255.255.255.240 128.32.64.0 255.255.255.192 can be used to specify different netmasks in different parts of the 128.32.0.0 Class B network number. Addresses 128.32.27.0 through 128.32.27.255 have a subnet mask with 28 bits in the combined network and subnet fields (often referred to as the subnet field) and 4 bits in the host field. Furthermore, addresses 128.32.64.0 through 128.32.64.63 have a 26 bits in the subnet field. Finally, all other addresses in the range 128.32.0.0 through 128.32.255.255 have a 24 bit subnet field. Invalid entries are ignored. SEE ALSO
ifconfig(1M), inet(7P) Postel, Jon, and Mogul, Jeff, Internet Standard Subnetting Procedure, RFC 950, Network Information Center, SRI International, Menlo Park, Calif., August 1985. V. Fuller, T. Li, J. Yu, K. Varadhan, Classless Inter-Domain Routing (CIDR): an Address Assignment and Aggregation Strategy, RFC 1519, Network Information Center, SRI International, Menlo Park, Calif., September 1993. T. Pummill, B. Manning, Variable Length Subnet Table For IPv4, RFC 1878, Network Information Center, SRI International, Menlo Park, Calif., December 1995. NOTES
/etc/inet/netmasks is the official SVr4 name of the netmasks file. The symbolic link /etc/netmasks exists for BSD compatibility. SunOS 5.10 7 Jan 1997 netmasks(4)
All times are GMT -4. The time now is 07:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy