Sponsored Content
Top Forums Shell Programming and Scripting Help with sort word followed by exponential number and numeric number at the same time Post 302786285 by cpp_beginner on Wednesday 27th of March 2013 07:18:49 AM
Old 03-27-2013
Help with sort word followed by exponential number and numeric number at the same time

Input file:
[code]
ID_34 2E-69 2324
ID_1 0E0 3254
ID_1 0E0 5434
ID_5 0E0 436
ID_1 1E-14 2524
ID_1 5E-52 46437
ID_3 65E-20 45467
ID_1 0E0 6578
...
[code]
Desired output file:
Code:
ID_1 0E0 6578
ID_1 0E0 5434
ID_1 0E0 3254
ID_1 5E-52 46437
ID_1 1E-14 2524
ID_3 65E-20 45467
ID_5 0E0 436
ID_34 2E-69 2324
...

I wanna to sort the first column from smallest to largest first. After then, sort the exponential number from smallest to largest. At last, only sort the third column from largest to smallest.
All must sort at the same time running.

command I try:
Code:
sort -t_ -k2n -k2,2g -k3,3r input_file

But it seems like can't really work if I deal with huge data set.
Thanks for any advice.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to numeric sort on field time

i want to sort time field given by who command as a whole i have tried like this who|sort -n +4 -5 (1 Reply)
Discussion started by: rahulspatil_111
1 Replies

2. Shell Programming and Scripting

Conversion of Exponential to numeric in awk- not correct output

Hi All, I have 1 million records file. Using awk, I am counting the number of records. But as the number is huge, after crossing a number, awk is displaying it in exponential format. At the end, I need to verify this count given by awk with expected count. But as it is in exponential format,... (3 Replies)
Discussion started by: ssunda6
3 Replies

3. Linux

How to sort the number of occurrences

file:///C:/Users/TSHEPI%7E1.LEB/AppData/Local/Temp/moz-screenshot.pngATM@ubuntu:~$ cat numbers2 | sort -n | uniq -c 1 7 1 11 2 10 3 the 1st numbers are the counts from the command "uniq -c", which represent the number of occurrences of each in the file. The "sort -n"... (4 Replies)
Discussion started by: lebogot
4 Replies

4. UNIX for Advanced & Expert Users

query display number lines or records present in file only numeric value -without filename

Hi all Thanks in advance........... Please help me for this issue............ I have a file it has 11 records . I used the command like .... >$ wc -l file 11 file I'm getting output like 11 file (no.of records along with filename) here my requirement is, I want to display only... (3 Replies)
Discussion started by: ksrivani
3 Replies

5. Shell Programming and Scripting

How can I sort by n number is like words?

I want to sort a file with a list of words, in order of most occuring words to least occurring words as well as alphabetically. ex: file1: cat 3 cat 7 cat 1 dog 3 dog 5 dog 9 dog 1 ape 4 ape 2 I want the outcome to be: file1.sorted: dog 1 (12 Replies)
Discussion started by: castrojc
12 Replies

6. Shell Programming and Scripting

How to sort the files according to the number?

Hi Everyone, I have a question: I have a lot of file named like or10000.dat, or9100.dat, or100.dat, or3100.dat... I want to deal with these files according to the number in the name. So I want to deal with or100.dat first and then or3100.dat and so on. I used : for i in `ls or*.dat |... (11 Replies)
Discussion started by: wxuyec
11 Replies

7. Shell Programming and Scripting

Help with sort word and general numeric sort at the same time

Input file: 100%ABC2 3.44E-12 USA A2M%H02579 0E0 UK 100%ABC2 5.34E-8 UK 100%ABC2 3.25E-12 USA A2M%H02579 5E-45 UK Output file: 100%ABC2 3.44E-12 USA 100%ABC2 3.25E-12 USA 100%ABC2 5.34E-8 UK A2M%H02579 0E0 UK A2M%H02579 5E-45 UK Code try: sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. Shell Programming and Scripting

Print only word not number

Hi, Need to extract only words not numbers #cat test.txt 123456 oracle web 56789 s21adm Required output #grep <options> test.txt oracle web s21adm Note, in between integer "s21adm" is required but not with full integer "123456" and "56789" (6 Replies)
Discussion started by: ksgnathan
6 Replies

9. UNIX for Dummies Questions & Answers

Sort by alpha then by number

I have a file like the following: /vol/release /vol/listing /vol/trees7 /vol/toperforce /vol/trees10 /vol/trees2 /vol/wtrain I have tried the following: cat file | sort -t/ -dfk3.1 -t/ -k3.6n That did not work. What I want to do is have the file sorted so that the first... (2 Replies)
Discussion started by: newbie2010
2 Replies

10. Shell Programming and Scripting

Find a word and increment the number in the word & save into new files

Hi All, I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl: run_build_model sparc_ifu_dec run_drc set_faults -model path_delay -atpg_effectiveness -fault_coverage add_delay_paths P1 set_atpg -abort_limit 1000 run_atpg -ndetects 1000 I would like... (6 Replies)
Discussion started by: jypark22
6 Replies
Math::Symbolic::Custom::DefaultTests(3pm)		User Contributed Perl Documentation		 Math::Symbolic::Custom::DefaultTests(3pm)

NAME
Math::Symbolic::Custom::DefaultTests - Default Math::Symbolic tree tests SYNOPSIS
use Math::Symbolic; DESCRIPTION
This is a class of default tests for Math::Symbolic trees. Likewise, Math::Symbolic::Custom::DefaultMods defines default tree transformation routines. For details on how the custom method delegation model works, please have a look at the Math::Symbolic::Custom and Math::Symbolic::Custom::Base classes. EXPORT Please see the docs for Math::Symbolic::Custom::Base for details, but you should not try to use the standard Exporter semantics with this class. SUBROUTINES
is_zero() Returns true(1) of the tree is a constant and '0'. Returns false(0) otherwise. is_one() Returns true(1) of the tree is a constant and '1'. Returns false(0) otherwise. is_zero_or_one() Returns true ('1' for 1, '0E0' for 0) of the tree is a constant and '1' or '0'. Returns false(0) otherwise. is_integer() is_integer() returns a boolean. It returns true(1) if the tree is a constant object representing an integer value. It does not compute the value of the tree. (eg. '5*10' is not considered an integer, but '50' is.) It returns false(0) otherwise. is_simple_constant() is_simple_constant() returns a boolean. It returns true if the tree consists of only constants and operators. As opposed to is_constant(), is_simple_constant() does not apply derivatives if necessary. It returns false(0) otherwise. is_constant() is_constant() returns a boolean. It returns true(1) if the tree consists of only constants and operators or if it becomes a tree of only constants and operators after application of derivatives. It returns false(0) otherwise. If you need not pay the price of applying derivatives, you should use the is_simple_constant() method instead. is_identical() is_identical() returns a boolean. It compares the tree it is called on to its first argument. If the first argument is not a Math::Symbolic tree, it is sent through the parser. is_identical() returns true(1) if the trees are completely identical. That includes operands of commutating operators having the same order, etc. This does not test of mathematical equivalence! (Which is much, much harder to test for. If you know how to, please let me know!) It returns false(0) otherwise. is_identical_base is_identical_base() returns a boolean. It compares the tree it is called on to its first argument. If the first argument is not a Math::Symbolic tree, it is sent through the parser. is_identical_base() returns true(1) if the trees are identical or if they are exponentiations with the same base. The same gotchas that apply to is_identical apply here, too. For example, 'x*y' and '(x*y)^e' result in a true return value because 'x*y' is equal to '(x*y)^1' and this has the same base as '(x*y)^e'. It returns false(0) otherwise. is_sum() (beta) is_constant() returns a boolean. It returns true(1) if the tree contains no variables (because it can then be evaluated to a single constant which is a sum). It also returns true if it is a sum or difference of constants and variables. Furthermore, it is true for products of integers and constants because those products are really sums of variables. If none of the above cases match, it applies all derivatives and tries again. It returns false(0) otherwise. Please contact the author in case you encounter bugs in the specs or implementation. The heuristics aren't all that great. test_num_equiv() Takes another Math::Symbolic tree or a code ref as first argument. Tests the tree it is called on and the one passed in as first argument for equivalence by sampling random numbers for their parameters and evaluating them. This is no guarantee that the functions are actually similar. The computation required for this test may be very high for large numbers of tests. In case of a subroutine reference passed in, the values of the parameters of the Math::Symbolic tree are passed to the sub ref sorted by the parameter names. Following the test-tree, there may be various options as key/value pairs: limits: A hash reference with parameter names as keys and code refs as arguments. A code ref for parameter 'x', will be executed for every number of 'x' that is generated. If the code returns false, the number is discarded and regenerated. tests: The number of tests to carry out. Default: 20 epsilon: The accuracy of the numeric comparison. Default: 1e-7 retries: The number of attempts to make if a function evaluation throws an error. upper: Upper limit of the random numbers. Default: 10 lower: Lower limit of the random numbers. Default: -10 AUTHOR
Please send feedback, bug reports, and support requests to the Math::Symbolic support mailing list: math-symbolic-support at lists dot sourceforge dot net. Please consider letting us know how you use Math::Symbolic. Thank you. If you're interested in helping with the development or extending the module's functionality, please contact the developers' mailing list: math-symbolic-develop at lists dot sourceforge dot net. List of contributors: Steffen Mueller, symbolic-module at steffen-mueller dot net Stray Toaster, mwk at users dot sourceforge dot net Oliver Ebenhoeh SEE ALSO
New versions of this module can be found on http://steffen-mueller.net or CPAN. The module development takes place on Sourceforge at http://sourceforge.net/projects/math-symbolic/ Math::Symbolic::Custom Math::Symbolic::Custom::DefaultDumpers Math::Symbolic::Custom::DefaultMods Math::Symbolic perl v5.10.1 2011-01-01 Math::Symbolic::Custom::DefaultTests(3pm)
All times are GMT -4. The time now is 08:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy