Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AWK coding help

Status
Not open for further replies.

jaisask

Technical User
Jan 18, 2015
2
CA
1 am newbie in awk.

i have a tab deliminated text file. the format is as follows. 3 records, 4 fields separated by tabs
SNP 100 101 102 103
M1 a:5 b:4 a:26 b:3
M2 a:4 b:45 a:6 b:18
M3 a:50 b:40 a:26 b:30

please help me in filtering the file based on number behind the colon [:] using awk.

1) let's say, if the number after the colon [:] equal or more than 5, then just print "a" or "b"
2)if the number after the colon [:] is less than 5 then print "X".


Thanks in advance
 
What have you tried so far and where in your code are you stuck ?
Tip: have a look at the Split function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV.

my knowledge about awk is too basic. i copuldn't make a code to process my file. i was teaching hard to myself to learn awk (for example i know split function) though unfortunately i havent reached to the level where i can code myself.

i ll highly appreciate if you acn help me out.

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top