Sponsored Content
Top Forums Shell Programming and Scripting Sorting with header and mixed numerals (scientific and decimal) | awk Post 302485206 by genehunter on Tuesday 4th of January 2011 01:58:40 PM
Old 01-04-2011
Quote:
Originally Posted by vgersh99
try this:
Code:
nawk 'FNR==1{print | "cat 1>&2";next}$5=="ADD" {print $0}' OFS='\t'  Assoc.txt |sort -nrk9

Code:
awk 'FNR==1{print | "cat 1>&2";next}$5=="ADD" {print $0}' OFS='\t'  Assoc.txt  |sort -gk9 >Assoc_sorted.TXT

Code:
CHR         SNP         BP   A1       TEST    NMISS         OR         STAT            P 
FL_NoOutlr :~>head Foll_LRM_Sorted.TXT
   6   rs4530903   32689867    A        ADD     4151      2.084        5.538    3.067e-08
   6   rs9268853   32537621    C        ADD     4182      1.749        5.335    9.552e-08
   6   rs9469220   32766288    C        ADD     4164     0.5633       -5.237    1.628e-07

What happens is that it prints the header on to the terminal and the rest is piped out to the file output.
Also found out that -gk9 works for scientific notation. -nrk9 did not work as expected.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extracting only numerals from string.

Hi!!! i have two files "tushar20090429200000.txt" and "tushar_err20090429200000.txt" The numeric part here is date and time. So this part of file keeps changing after every hour. I want to extract the numeric part from the both file names and compare them whether they are equal or not. ... (4 Replies)
Discussion started by: tushar_tus
4 Replies

2. Shell Programming and Scripting

Sort roman numerals

If I use ls to print all the files of a folder, is there a way to sort using roman numerals? I am thinking about a result like: benjamin_I.wmv benjamin_II.wmv benjamin_II.wmv benjamin_III.wmv benjamin_IV.wmv benjamin_V.wmv benjamin_VI.wmv benjamin_VII.wmv benjamin_VIII.wmv... (6 Replies)
Discussion started by: locoroco
6 Replies

3. UNIX for Dummies Questions & Answers

awk for scientific notion and decimal combined data

Dea all, I have a question. I have a column of numbers with scientific notion and decimal combined data. I want to print it only if the number <0.05 using awk. however the very small numbers with scientific notion is not selected. Do any one know how to solve it? Thanks! example as below: ... (4 Replies)
Discussion started by: forevertl
4 Replies

4. Shell Programming and Scripting

Sorting mixed numbers and letters

Hello, I have a file such as this: chr1 chr2 chr1 chr2 chr3 chr10 chr4 chr5 chrz chr1AI want to sort it, I use this command: sort -k1 -th -n testfilebut I get this output, how can I fix this? chr1 chr1 chr10 chr1A chr2 chr2 (3 Replies)
Discussion started by: Homa
3 Replies

5. Shell Programming and Scripting

awk - mixed for and if to select particular lines in a data file

Hi all, I am new to AWK and I am trying to solve a problem that is probably easy for an expert. Suppose I have the following data file input.txt: 20 35 43 20 23 54 20 62 21 20.5 43 12 20.5 33 11 20.5 89 87 21 33 20 21 22 21 21 56 87 I want to select from all lines having the... (4 Replies)
Discussion started by: naska
4 Replies

6. Shell Programming and Scripting

Using awk to parse a file with mixed formats in columns

Greetings I have a file formatted like this: rhino grey weight=1003;height=231;class=heaviest;histology=9,0,0,8 bird white weight=23;height=88;class=light;histology=7,5,1,0,0 turtle green weight=40;height=9;class=light;histology=6,0,2,0... (2 Replies)
Discussion started by: Twinklefingers
2 Replies

7. Shell Programming and Scripting

Perl: scientific notation to decimal notation

hello folks, I have few values in a log which are in scientific notation. I am trying to convert into actual decimal format or integer but couldn't able to convert. Values in scientific notation: 1.1662986666666665E-4 2.0946799999999998E-4 3.0741333333333333E-6 5.599999999999999E-7... (2 Replies)
Discussion started by: scriptscript
2 Replies

8. UNIX for Dummies Questions & Answers

How to control the decimal points for p-values in scientific format?

Dear all, I have a txt file with only one column which contains p values. My data looks like this: 5.04726976606584e-190 2.94065711152402e-189 2.94065711152402e-189 9.19932135717279e-176 1.09472516659859e-170 1.24974648916809e-170 0.1223974648916 0.9874974648916 ... what I want... (2 Replies)
Discussion started by: forevertl
2 Replies

9. Shell Programming and Scripting

Help with filter result (scientific notation) by using awk

Input file: data1 0.05 data2 1e-14 data1 1e-330 data2 1e-14 data5 2e-60 data5 2e-150 data1 4e-9 Desired output: data2 1e-14 data1 1e-330 data2 1e-14 data5 2e-60 data5 2e-150 I would like to filter out those result that column 2 is less than 1e-10. Command try: (1 Reply)
Discussion started by: cpp_beginner
1 Replies

10. OS X (Apple)

Sorting scientific numbers with sort

Hey everybody, I'm trying to sort scientific numbers in a descending order using the command sort -gr <file>. It works fine on a Linux-Server, but doesn't on my macbook pro with OS X 10.10.3 (Yosemite). I tried to sort the following: 6.38e-10 6.38e-10 1.80e-11 1.00e-10 1.48e-12 And... (9 Replies)
Discussion started by: plebs
9 Replies
ALTER FOREIGN DATA 
WRAPPER(7) PostgreSQL 9.2.7 Documentation ALTER FOREIGN DATA WRAPPER(7) NAME
ALTER_FOREIGN_DATA_WRAPPER - change the definition of a foreign-data wrapper SYNOPSIS
ALTER FOREIGN DATA WRAPPER name [ HANDLER handler_function | NO HANDLER ] [ VALIDATOR validator_function | NO VALIDATOR ] [ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ] ALTER FOREIGN DATA WRAPPER name OWNER TO new_owner ALTER FOREIGN DATA WRAPPER name RENAME TO new_name DESCRIPTION
ALTER FOREIGN DATA WRAPPER changes the definition of a foreign-data wrapper. The first form of the command changes the support functions or the generic options of the foreign-data wrapper (at least one clause is required). The second form changes the owner of the foreign-data wrapper. Only superusers can alter foreign-data wrappers. Additionally, only superusers can own foreign-data wrappers. PARAMETERS
name The name of an existing foreign-data wrapper. HANDLER handler_function Specifies a new handler function for the foreign-data wrapper. NO HANDLER This is used to specify that the foreign-data wrapper should no longer have a handler function. Note that foreign tables that use a foreign-data wrapper with no handler cannot be accessed. VALIDATOR validator_function Specifies a new validator function for the foreign-data wrapper. Note that it is possible that after changing the validator the options to the foreign-data wrapper, servers, and user mappings have become invalid. It is up to the user to make sure that these options are correct before using the foreign-data wrapper. NO VALIDATOR This is used to specify that the foreign-data wrapper should no longer have a validator function. OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) Change options for the foreign-data wrapper. ADD, SET, and DROP specify the action to be performed. ADD is assumed if no operation is explicitly specified. Option names must be unique; names and values are also validated using the foreign data wrapper's validator function, if any. new_owner The user name of the new owner of the foreign-data wrapper. new_name The new name for the foreign-data wrapper. EXAMPLES
Change a foreign-data wrapper dbi, add option foo, drop bar: ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar'); Change the foreign-data wrapper dbi validator to bob.myvalidator: ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator; COMPATIBILITY
ALTER FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED), except that the HANDLER, VALIDATOR, OWNER TO, and RENAME clauses are extensions. SEE ALSO
CREATE FOREIGN DATA WRAPPER (CREATE_FOREIGN_DATA_WRAPPER(7)), DROP FOREIGN DATA WRAPPER (DROP_FOREIGN_DATA_WRAPPER(7)) PostgreSQL 9.2.7 2014-02-17 ALTER FOREIGN DATA WRAPPER(7)
All times are GMT -4. The time now is 10:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy