Hi I have a file with data like this.
-1 2 ereu
1 2 rerer
2 2 rere
3 2 eee
3 2 wwwe
9 2 qqewew
9 2 vvvgf
-1 2 wwwew
4 3 wwew
-9 3 wwss
6 3 jjuu
7 3 kkii
7 3 ggtyu
8 3 ffder
1 4 rrtrr
1 4 rree
If the values in 2nd column are same, calculate the minimum value in the first column and print...
Hi,
I rather have a very complicated awk problem here, at least to me. I have two files.
File 1:
607 687 174 0 0 chr1 3000001 3000156 -194195276 - L1_Mur2 LINE L1 -4310 1567 1413 1
607 917 214 114 45 chr1 3000237 3000733 -194194699 - L1_Mur2 LINE L1 -4488 1389 913 1
607 215 31 0 30 chr1...
The actual file is very big (1.4GB with 8 million lines). I did not post even a sample here because it might have looked very complex. ANyhow, I am posting first fewlines here:
2|1,23,8,NM_175153,chr9:64808744-64812188 +...
///Sorry, my mistake. It should be FS=OFS=",", not RS=ORS=",". ///
Thank you very much. Its working perfectly.
I have a related question. I have another table but with 19 columns.
2|1,23,8,mm9,+,682,13,0.70,1.0,-1,6,18,28,40,cga,cga,|||,13,13
I want the same function to be performed as...
///Then type gawk -f least.awk input.file at the command prompt.///
Thanks again. The script is working. But the out put is not what I expected. The out put is coming like this:
0.5 25 ,1.2 37 ,1.7 34 ,2.3 37 ,3.0 37 ,0.2 25 ,
But I need an out put like below:
25,AGH,0.2
34,TUY,3.0...
///What OS/platform are you doing this on? You may need to use nawk instead of awk.////
I am using windows XP professional. I copied and pasted in the script and tried and it did not work. I use gawk.
oops - small correction
Here is the input file *same as the above except with an additional line at 5. Lines 5,6.7 have same field 1, but i need to isolate only lines 6 and 7 because they have same least field 3 values (1.2).
25,AGH,0.2
25,GHT,0.5
25,jsw,1.7
34,TUY,3.0
37,KJJ,2.3
37,KJU,1.2...
Hi folks. I have data something like this:
25,AGH,0.2
25,GHT,0.5
25,jsw,1.7
34,TUY,3.0
37,KJU,1.2
37,KJT,1.2
The logic I want to input here is that IF field 1 of lines are same, then isolate the line with the least field 3 value in to a new file.
For example - lines 1,2,3 have same field 1...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.