Sponsored Content
Top Forums Shell Programming and Scripting Match all lines in file where specific text pattern is less than Post 302988243 by cmccabe on Thursday 22nd of December 2016 10:53:14 AM
Old 12-22-2016
Match all lines in file where specific text pattern is less than

In the below file I am trying to grep or similar, all lines where only AF= is less than 0.4.. Thank you Smilie.

grep
Code:
grep "AF=" ,+ .4 file

file
Code:
12    112036782    .    T    C    34.0248    PASS    AF=0.194286;AO=32;DP=170;FAO=34;FDP=175;FR=.;FRO=141;FSAF=20;FSAR=14;FSRF=57;FSRR=84;FWDB=-0.0842492;FXX=0.0056815;HRUN=2;LEN=1;MLLD=83.7705;OALT=C;OID=.;OMAPALT=C;OPOS=112036782;OREF=T;PB=0.5;PBP=1;QD=0.77771;RBI=0.128679;REFB=-0.0310314;REVB=-0.0972646;RO=137;SAF=20;SAR=12;SRF=55;SRR=82;SSEN=0;SSEP=0;SSSB=0.280873;STB=0.645079;STBP=0.067;TYPE=snp;VARB=0.090833;ANN=ATXN2    GT:GQ:DP:FDP:RO:FRO:AO:FAO:AF:SAR:SAF:SRF:SRR:FSAR:FSAF:FSRF:FSRR    0/1:34:170:175:137:141:32:34:0.194286:12:20:55:82:14:20:57:84
12    112036795    .    T    A    34.0248    PASS    AF=0.45121;AO=32;DP=170;FAO=34;FDP=175;FR=.;FRO=141;FSAF=20;FSAR=14;FSRF=57;FSRR=84;FWDB=-0.0842492;FXX=0.0056815;HRUN=2;LEN=1;MLLD=83.7705;OALT=C;OID=.;OMAPALT=C;OPOS=112036782;OREF=T;PB=0.5;PBP=1;QD=0.77771;RBI=0.128679;REFB=-0.0310314;REVB=-0.0972646;RO=137;SAF=20;SAR=12;SRF=55;SRR=82;SSEN=0;SSEP=0;SSSB=0.280873;STB=0.645079;STBP=0.067;TYPE=snp;VARB=0.090833;ANN=ATXN2    GT:GQ:DP:FDP:RO:FRO:AO:FAO:AF:SAR:SAF:SRF:SRR:FSAR:FSAF:FSRF:FSRR    0/1:34:170:175:137:141:32:34:0.194286:12:20:55:82:14:20:57:84

desired output
Code:
12    112036782    .    T    C    34.0248    PASS     AF=0.194286;AO=32;DP=170;FAO=34;FDP=175;FR=.;FRO=141;FSAF=20;FSAR=14;FSRF=57;FSRR=84;FWDB=-0.0842492;FXX=0.0056815;HRUN=2;LEN=1;MLLD=83.7705;OALT=C;OID=.;OMAPALT=C;OPOS=112036782;OREF=T;PB=0.5;PBP=1;QD=0.77771;RBI=0.128679;REFB=-0.0310314;REVB=-0.0972646;RO=137;SAF=20;SAR=12;SRF=55;SRR=82;SSEN=0;SSEP=0;SSSB=0.280873;STB=0.645079;STBP=0.067;TYPE=snp;VARB=0.090833;ANN=ATXN2     GT:GQ:DP:FDP:RO:FRO:AO:FAO:AF:SAR:SAF:SRF:SRR:FSAR:FSAF:FSRF:FSRR     0/1:34:170:175:137:141:32:34:0.194286:12:20:55:82:14:20:57:84

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Merge two file data together based on specific pattern match

My input: File_1: 2000_t g1110.b1 abb.1 2001_t g1111.b1 abb.2 abb.2 g1112.b1 abb.3 2002_t . . File_2: 2000_t Ali england 135 abb.1 Zoe british 150 2001_t Ali england 305 g1111.b1 Lucy russia 126 (6 Replies)
Discussion started by: patrick87
6 Replies

2. Shell Programming and Scripting

[bash help]Adding multiple lines of text into a specific spot into a text file

I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it. For example, Here is a portion of a zone file. IN NS ns1.domain.tld. IN NS ns2.domain.tld. IN ... (2 Replies)
Discussion started by: cdn_humbucker
2 Replies

3. Shell Programming and Scripting

deleting lines in a file that match a pattern without opening it

In Unix, how do I delete lines in a file that match a particular pattern without opening it. File contents are foo line1 misc whatever foo line 2 i want to delete all lines that have the pattern "foo" without opening the file. File should eventually contain misc whatever (1 Reply)
Discussion started by: osbourneric
1 Replies

4. Shell Programming and Scripting

fetch last line no form file which is match with specific pattern by grep command

Hi i have a file which have a pattern like this Nov 10 session closed Nov 10 Nov 9 08:14:27 EST5EDT 2010 on tty . Nov 10 Oct 19 02:14:21 EST5EDT 2010 on pts/tk . Nov 10 afrtetryytr Nov 10 session closed Nov 10 Nov 10 03:21:04 EST5EDT 2010 Dec 8 Nov 10 05:03:02 EST5EDT 2010 ... (13 Replies)
Discussion started by: Himanshu_soni
13 Replies

5. Shell Programming and Scripting

Help with ksh-to read ip file & append lines to another file based on pattern match

Hi, I need help with this- input.txt : L B white X Y white A B brown M Y black Read this input file and if 3rd column is "white", then add specific lines to another file insert.txt. If 3rd column is brown, add different set of lines to insert.txt, and so on. For example, the given... (6 Replies)
Discussion started by: prashob123
6 Replies

6. Shell Programming and Scripting

Printing next two lines from a file after grepping a specific pattern

Hi I have a file like # vi require.txt 1,BANK,Read blocks that cycle. yellow Read blocks. 2,ACCOUNT,Finished Red Finished . 3,LOAN, pipe white pipe 4,PROFIT,Resolve. black Resolve Am using like cat require.txt | grep -w ACCOUNTThe output I get is (8 Replies)
Discussion started by: Priya Amaresh
8 Replies

7. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

8. Shell Programming and Scripting

Match text from file 1 to file 2 and return specific text

I hope this makes sense and is possible. I am trying to match $1 of panel_genes.txt with $3 of RefSeqGene.txt and when a match is found the value in $6 of RefSeqGene.txt Example: ACTA2 is $1 of panel_genes.txt ACTA2 NM_001613.2 ACTA2 NM_001141945.1 awk 'FNR==NR {... (4 Replies)
Discussion started by: cmccabe
4 Replies

9. UNIX for Beginners Questions & Answers

Match pattern only between certain lines in entire file

Hello, I have input that looks like this: * 0 -1 103 0 0 m. 7 LineNr 23 ClauseNr 1: 1: 1: 304: 0 0 SentenceNr 13 TxtType: Q Pargr: 2.1 ClType:MSyn PS004,006 ZBX= 0 1 1 0 7 -1 -1 3 2 3 2 -1 1 1 -1 -1 -1 -1 0 501 0 PS004,006 ZBX ... (2 Replies)
Discussion started by: jvoot
2 Replies

10. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
ISGRAPH(3)						   BSD Library Functions Manual 						ISGRAPH(3)

NAME
isgraph -- printing character test (space character exclusive) LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <ctype.h> int isgraph(int c); int isgraph_l(int c, locale_t loc); DESCRIPTION
The isgraph() function tests for any printing character except space (' ') and other locale-specific space-like characters. The value of the argument must be representable as an unsigned char or the value of EOF. In the ASCII character set, this includes the following characters (with their numeric values shown in octal): 041 ``!'' 042 ``"'' 043 ``#'' 044 ``$'' 045 ``%'' 046 ``&'' 047 ``''' 050 ``('' 051 ``)'' 052 ``*'' 053 ``+'' 054 ``,'' 055 ``-'' 056 ``.'' 057 ``/'' 060 ``0'' 061 ``1'' 062 ``2'' 063 ``3'' 064 ``4'' 065 ``5'' 066 ``6'' 067 ``7'' 070 ``8'' 071 ``9'' 072 ``:'' 073 ``;'' 074 ``<'' 075 ``='' 076 ``>'' 077 ``?'' 100 ``@'' 101 ``A'' 102 ``B'' 103 ``C'' 104 ``D'' 105 ``E'' 106 ``F'' 107 ``G'' 110 ``H'' 111 ``I'' 112 ``J'' 113 ``K'' 114 ``L'' 115 ``M'' 116 ``N'' 117 ``O'' 120 ``P'' 121 ``Q'' 122 ``R'' 123 ``S'' 124 ``T'' 125 ``U'' 126 ``V'' 127 ``W'' 130 ``X'' 131 ``Y'' 132 ``Z'' 133 ``['' 134 ``'' 135 ``]'' 136 ``^'' 137 ``_'' 140 ```'' 141 ``a'' 142 ``b'' 143 ``c'' 144 ``d'' 145 ``e'' 146 ``f'' 147 ``g'' 150 ``h'' 151 ``i'' 152 ``j'' 153 ``k'' 154 ``l'' 155 ``m'' 156 ``n'' 157 ``o'' 160 ``p'' 161 ``q'' 162 ``r'' 163 ``s'' 164 ``t'' 165 ``u'' 166 ``v'' 167 ``w'' 170 ``x'' 171 ``y'' 172 ``z'' 173 ``{'' 174 ``|'' 175 ``}'' 176 ``~'' The isgraph_l() function takes an explicit locale argument, whereas the isgraph() function uses the current global or per-thread locale. RETURN VALUES
The isgraph() and isgraph_l() functions return zero if the character tests false and return non-zero if the character tests true. COMPATIBILITY
The 4.4BSD extension of accepting arguments outside of the range of the unsigned char type in locales with large character sets is considered obsolete and may not be supported in future releases. The iswgraph() function should be used instead. SEE ALSO
ctype(3), iswgraph(3), ascii(7) STANDARDS
The isgraph() function conforms to ISO/IEC 9899:1990 (``ISO C90''). The isgraph_l() function conforms to IEEE Std 1003.1-2008 (``POSIX.1''). BSD
July 30, 2012 BSD
All times are GMT -4. The time now is 09:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy