Search Results

Search: Posts Made By: Geneanalyst
1,854
Posted By Geneanalyst
Never mind, the following AWK code works: ...
Never mind, the following AWK code works:


awk -F '\t' '{ for(i=1;i<=NF;i++) total[i]+=$i ; } END { for(i=1;i<=NF;i++) printf "%f ",total[i]/NR ;}'


Header can easily be added with:

...
1,854
Posted By Geneanalyst
Average each numeric column
Hi all,


Does anyone know of an efficient unix script to average each numeric column of a multi-column tab delimited file (with header) with some character columns.



Here is an example...
3,855
Posted By Geneanalyst
Thanks Don, I liked your 1st code, just learned...
Thanks Don, I liked your 1st code, just learned something!
3,855
Posted By Geneanalyst
Initialize file name bash shell - Linux
I am trying to initialize a file name in bash but not having much luck. For example, one of my bash scripts outputs a file named "FILE_1000G.vcf". I would like to rename FILE to match with the user's...
1,574
Posted By Geneanalyst
Nothing wrong with the END block. I edited my...
Nothing wrong with the END block. I edited my post above to outline the problem. Sorry for the trouble.
1,574
Posted By Geneanalyst
Works great! Initially it was outputting 40...
Works great! Initially it was outputting 40 million rows, but that was my bad because a "." had made its way into the column of data in file2 and file1 had many rows for which $3 was a "."
1,574
Posted By Geneanalyst
Works great! Initially it was outputting 80...
Works great! Initially it was outputting 80 million rows, but that was my bad because a ".' had made its way into the column of data in file2
1,574
Posted By Geneanalyst
Awk- Indexing a list of numbers in file2 to print certain rows in file1
Hi


Does anyone know of an efficient way to index a column of data in file2 to print the coresponding row in file1 which corresponds to the data in file2 AND 30 rows preceding and after the row...
1,401
Posted By Geneanalyst
That did the trick. One of the text files sent to...
That did the trick. One of the text files sent to me must have been processed with a windows machine...
1,401
Posted By Geneanalyst
Thanks Rudi, but that didn't produce the desired...
Thanks Rudi, but that didn't produce the desired output RESULT2. BTW, is there a quick way to clean up a file that may have hidden spaces and other sorts of things to make it a clean tab delimited...
1,401
Posted By Geneanalyst
Sorry, I forgot to add a step. I have edited my...
Sorry, I forgot to add a step. I have edited my post to reflect this....
1,401
Posted By Geneanalyst
awk incorrect format
I was wondering whether anyone has any idea what is happening here. I'm using simple code to compare 2 tab delimited files based on column 1 values. If the column1 value of file1 exists in file2,...
1,340
Posted By Geneanalyst
Sorry vgersh99, my bad. My file3 had some leading...
Sorry vgersh99, my bad. My file3 had some leading spaces which after cleaning up produced the correct output.


Thanks for the code!

------ Post updated at 11:21 AM ------




Do you mind...
1,340
Posted By Geneanalyst
Sorry vgersh99, but your code doesn't produce the...
Sorry vgersh99, but your code doesn't produce the desired output. Only 2 rows were printed (https://www.unix.com/members/37898.html)
1,340
Posted By Geneanalyst
awk conditional operators- lookup value in 2nd file
I use conditional operators alot in AWK to print rows from large text files based on values in a certain column. For example:


awk -F '\t' '{ if ($1 == "A" || $1 == "C" ) print $0}' OFS="\t"...
1,383
Posted By Geneanalyst
Awesome Rudy, you're a genius :)
Awesome Rudy, you're a genius :)
1,383
Posted By Geneanalyst
Conditional Vlookup
Hi everyone,

I need to replace values of column 2 array1 with values of column 2 array2 based on a lookup of column 4 value, but only return a value IF the values in column 1 of BOTH array1 and...
1,560
Posted By Geneanalyst
Looks like it works.
Looks like it works.
1,560
Posted By Geneanalyst
RudyC, Would the following modification ...
RudyC,


Would the following modification to your script be adequate if the input file IN1 was like this instead:

awk 'NR == FNR {REP[$1] = $4; next} $1 in REP && FNR > 1 { $4 = REP[$1];...
1,560
Posted By Geneanalyst
Scrutinizer, Could you please post...
Scrutinizer,

Could you please post explanation for the commands.

---------- Post updated at 03:36 PM ---------- Previous update was at 03:28 PM ----------

Scrutinizer or RudiC,

Is there a...
1,560
Posted By Geneanalyst
Thanks Scrutinizer, works beautifully !
Thanks Scrutinizer, works beautifully !
1,560
Posted By Geneanalyst
Array V-Lookup using UNIX bash
Hey everyone,

I am trying to extract column values from a column in a tab-delimited text file and overlay them in a 2nd tab-delimited text file using a V-lookup type script in Unix bash.

These...
1,796
Posted By Geneanalyst
Awesome drl !Great work, I appreciate all the...
Awesome drl !Great work, I appreciate all the effort :)
1,796
Posted By Geneanalyst
Hey RudiC, Could you explain the various...
Hey RudiC,

Could you explain the various steps of your code whenever you have time.
1,796
Posted By Geneanalyst
Thanks Ravinder, works good! What if...
Thanks Ravinder, works good!

What if instead of 2 arrays one needs to sum 3 arrays; array1 array2 array3.
Showing results 1 to 25 of 46

 
All times are GMT -4. The time now is 07:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy