You mean ONE or more homo AND NO hetero or NO homo AND ONE or more hetero? Then, yes, that's how you do it.
I have to admit, using >= 2 (or, in your second case, 1 ) would make the logics way clearer. I might adapt to that in the future...
Does awk work in a range of columns where I can specify groups
for example: (group 1: ranging from 6-60 and group 2: from 61-100)
and my separation will be based on hetero in group 1 and homo in group 2 in the same string and vice versa. is this separation is achievable ?
As always I appreciate your efforts in making SCIENCE great again
Just a question if I want to the separation to include equal or more than 1.
Do I have to modify the code to this:
Thanks
Yes, the code above should work. In this specific case (i.e., >0), you could further simplify the lines:
to:
And, as long as the only multi-character strings in your input file (other than in the header line) are the strings homo and hetero, and you want to create two output files you could also try:
Either of these suggested methods of processing your file could be modified to work on groups of fields. And, with the suggestions we have provided, you should be able to make an attempt to do so on your own. If you try it and can't quite get it to work, give us a clear specification of what you want to do, show us what you have tried to solve this update to the code we have provided, tell us where you're stuck, and we'll try to help you get to your goal.
This User Gave Thanks to Don Cragun For This Post:
Does awk work in a range of columns where I can specify groups
for example: (group 1: ranging from 6-60 and group 2: from 61-100)
.
.
.
Certainly. Logics might be more intricate. The for loop now runs from field 6 until the last field. Make it two loops, one from 6 to 60, the other from 61 to 100.
Hello All,
Here is am trying to get maximum value of third field depending on
first,second and fourth fields with awk command . delimeter is pipe(|) .
input
0221|09|14.25|aaa
0221|09|44.27|aaa
0221|09|44.33|aaa
0221|09|44.53|bbb
0221|09|34.32|bbb
0221|09|37.13|bbb... (5 Replies)
Trying to use awk to find a keyword and return the matches in the row, but also $1 and $2, which are the unique id's, but they only appear once. Thank you :).
file
name 31 Index Chromosomal Position Gene Inheritance
122 2106725 TSC2 AD
124 2115481 TSC2 AD
121 2105400 TSC2 AD... (6 Replies)
Hi,
Below is an example :
ST1 PREF: int1 AVAIL: int2
ST2 PREF :int1 AVAIL: int2
I need int1 to come in preferred variable while programming and int2 in available variable
Please help me doing so
Best regards,
Vishal (10 Replies)
Is it possible to modify file like this.
1. Remove all the duplicate names in a define column i.e 4th col
2. Count the no.of unique names separated by ";" and print as a 5th col
thanx in advance!!
Q
input
c1 30 3 Eh2
c10 96 3 Frp
c41 396 3 Ua5;Lop;Kol;Kol
c62 2 30 Fmp;Fmp;Fmp
... (5 Replies)
Hi,
I have gone through may posts and dint find exact solution for my requirement.
I have file which consists below data and same file have lot of other data.
<MAPPING DESCRIPTION ='' ISVALID ='YES' NAME='m_TASK_UPDATE' OBJECTVERSION ='1'>
<MAPPING DESCRIPTION ='' ISVALID ='NO'... (11 Replies)
Hi.
I have a tab separated file that has a couple nearly identical lines. When doing:
sort file | uniq > file.new
It passes through the nearly identical lines because, well, they still are unique.
a)
I want to look only at field x for uniqueness and if the content in field x is the... (1 Reply)
ok, so this is proving to be kind of difficult even though it should not be.
say for instance I want to grep out ONLY the word fkafal from the below output, how do I do it?
echo ajfjf fjfjf iafjga fkafal foeref afoafahfia | grep -w "fkafal"
If i run the above command, i get back all the... (4 Replies)
for example:
searches only for single word
for single word
this is line three
match=$(grep -n -e "single" data.txt)
this command will stored "..... single ...... single" into search.
how can i grep the single word just from line 2 only?? (3 Replies)