Parsing a list of data


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Parsing a list of data
# 1  
Old 08-06-2012
Parsing a list of data

Hi
I have a vcf file with 20000 lines, it looks like this-
Code:
23	122691	.	C	1345.09	PASS
33	122961	.	C	833.45	PASS
43	122970	.	A	689.75	PASS
53	123009	.	T	118.99	PASS
63	123033	.	T	46.85	PASS
73	123042	.	A	127.51	PASS
83	123060	.	T	299.64	PASS
93	123081	.	T	299.64	PASS
103	123105	.	C	210.83	PASS
113	123108	.	G	139.65	PASS
123	123147	.	A	132.79	PASS
133	123162	.	A	120.25	PASS
143	123171	.	G	174.31	SnpCluster
153	123177	.	C	109.46	SnpCluster
163	123180	.	G	146.46	SnpCluster
173	123282	.	A	10.22	LowQual;SnpCluster
183	123285	.	A	15.92	LowQual;SnpCluster
193	123288	.	G	15.92	LowQual;SnpCluster
203	123300	.	A	1327.57	PASS
213	123301	.	G	955.37	PASS
223	123321	.	A	708.37	PASS
233	123363	.	G	131.35	PASS
243	123366	.	A	742.72	PASS
253	123407	.	C	574.47	SnpCluster
263	123408	.	T	574.47	SnpCluster
273	123411	.	A	696.24	SnpCluster
283	123420	.	G	89.09	PASS
293	123426	.	A	690.57	PASS
303	123474	.	A	59.45	PASS
313	123477	.	C	576.22	PASS
323	123489	.	G	396.59	PASS
333	123651	.	C	79.36	PASS
343	123705	.	C	908.33	PASS
353	436405	.	C	969.24	PASS
363	436472	.	G	969.24	PASS
373	436614	.	C	1052.76	PASS
383	436684	.	A	718.68	PASS
393	436748	.	C	676.92	PASS
403	436760	.	T	718.68	PASS
413	436798	.	A	927.48	PASS

I want to filter this file based on the values/ranges in column 2. For example, in a new file I do not want lines with values 123171-123407, and 123651-436748 in column2. Please suggest any simple unix command.

Thanks

Last edited by Scott; 08-06-2012 at 06:59 PM.. Reason: Please use code tags, and a meaningful subject title to describe your problem. Thank you.
# 2  
Old 08-06-2012
Code:
nawk '!($2>=123171 && $2<=123407 && $2>=123651 && $2<=436748)' myFile

# 3  
Old 08-07-2012
Shouldn't there be a "logical or" || as the middle operator?
# 4  
Old 08-07-2012
Thanks! It worked using || as middle operator.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing XML (and insert data) then output data (bash / Solaris)

Hi folks I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file. It all works - apart from the xml and config file format in the new file with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies

2. Shell Programming and Scripting

Help with parsing data with awk , eliminating unwanted data

Experts , Below is the data: --- Physical volumes --- PV Name /dev/dsk/c1t2d0 VG Name /dev/vg00 PV Status available Allocatable yes VGDA 2 Cur LV 8 PE Size (Mbytes) 8 Total PE 4350 Free PE 2036 Allocated PE 2314 Stale PE 0 IO Timeout (Seconds) default --- Physical volumes ---... (5 Replies)
Discussion started by: rveri
5 Replies

3. Shell Programming and Scripting

Data parsing

Hi, I do have a data file which is divided into compartments by ---------. I would like to extract (parse) some of the data and numbers either using awk or sed The file has the format: CATGC Best GO enrichment: Genes/ORF that have the motifs (genes are sorted by max(pa+pd+po)): ... (6 Replies)
Discussion started by: Lucky Ali
6 Replies

4. Shell Programming and Scripting

Help in Parsing data

I have below string Transaction_ID:SDP-DM-151204679 , Transaction_DateTime:2011-02-11 00:00:15 GMT+05:30 , Transaction_Mode:WAP , Circle_ID:4 , Circle_Name:BJ ,Zone: , CustomerID:B_31563486 , MSISDN:7870904329 , IMSI:405876122068099 , IMEI: , Sub_Profile:Pre-Paid , CPID:Nazara , CPNAME:Nazara ,... (6 Replies)
Discussion started by: poweroflinux
6 Replies

5. Shell Programming and Scripting

Parsing the data

Hi friends, I need to parse the following data in the given format and get the desired output. I need a function, which takes the input as a parameter and the desired output will be returned from the function. INPUT(single parameter as complete string) A;BCF;DFG;FD ... (3 Replies)
Discussion started by: sumesh.1988
3 Replies

6. Shell Programming and Scripting

Parsing data

Hi all , I have a file with billing CDR records in it. I need to parse that information (row format) . The purpose is to compare full content. The example I have given below is a single line record but it has two portions, (1) the line start with “!” and end with “1.2.1.8” and (2) second part... (5 Replies)
Discussion started by: jaygamini
5 Replies

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

8. Shell Programming and Scripting

More efficent Data Parsing

I am looking for a way to parse out some numbers from text. This is an excerpt from a larger script that I am trying to make run a little smoother. Specifically this script is used to Capture DV video streams on a linux machine from the terminal. The setup does 6 streams at once, and this part... (3 Replies)
Discussion started by: Starcast
3 Replies

9. Shell Programming and Scripting

parsing data for certain conditions

Hi guys, I have got this working OK but I am sure there is a more efficient/elegant way of doing it, which I hope you can help me with. It can be done in whatever is most suitable i.e perl/awk.. Any suggestions are welcome and many thanks in advance. What I require is to extract... (5 Replies)
Discussion started by: PAW
5 Replies

10. Shell Programming and Scripting

Parsing the data

Hi I need to parse the following data using shell script Table ----- stage4n_abc 48 stage4o_abcd 4 adashpg_abc_HeartBeat 1 stage4l_asc 168 Can anyone gimme the solution. I want each value to get stored in an array or variable and want the value to be greped from another file.... (1 Reply)
Discussion started by: Archana.Dheepan
1 Replies
Login or Register to Ask a Question