Sponsored Content
Full Discussion: sorting in awk
Top Forums Shell Programming and Scripting sorting in awk Post 302105078 by mahabunta on Tuesday 30th of January 2007 02:11:13 PM
Old 01-30-2007
sorting in awk

i have following file have following type of data

1~%%~fcashfafh~%%~9797

can i sort(numeric) the file on first field and then on last feild using awk
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk sorting

Hi, I have used the following code to sort two sets of data: awk '{printf "%10s %s\n",$1,$2}' The first column is text and the second involves numbers. I was just wondering how i would go about sorting the second number so that they ascend from the top? Thanks for any help (4 Replies)
Discussion started by: Jaken
4 Replies

2. Shell Programming and Scripting

Is there any better way for sorting in bash/awk

Hi, I have a file which is:- 1 6 4 8 2 3 2 1 9 3 2 1 3 3 5 6 3 1 4 9 7 8 2 3 I would like to sort from field $2 to field $6 for each of the line to:- 1 2 3 4 6 8 2 1 1 2 3 9 3 1 3 3 5 6 4 2 3 7 8 9 I came across this Arrays on example 26-6. But it is much complicated. I am... (7 Replies)
Discussion started by: ahjiefreak
7 Replies

3. Shell Programming and Scripting

AWK, sorting-if and print help.

Little-bit of awk experience, need some of the expert help on here. Browsed around here, got a little further, but I am still missing some pieces. Can you help me fill-in my missing awk cells? Sample data file (leaving out ","'s): Column 1 Column 2 Column 3 Column 4 ... (10 Replies)
Discussion started by: boolean2222
10 Replies

4. Shell Programming and Scripting

Sorting with sed,awk ...

I need to sort this input using sed, awk or any other tool to give below output Input: RXOCF-8 CLASS 2A 57 RU 40 RXORX-8-0 CLASS 1B 23 45 16 RXORX-8-1 EXTERNAL CLASS 2A (12 Replies)
Discussion started by: aydj
12 Replies

5. Shell Programming and Scripting

Sorting inside awk

I have an array with five columns and i want to write it to a file. Before writing it i must sort it using the field in the fifth column. _________________________________________ |field 1|field 2|field 3|field 4|field 5| | | | | | | | | | |... (6 Replies)
Discussion started by: beatblaster666
6 Replies

6. Shell Programming and Scripting

AWK/GREP sorting help

hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this; 192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible sort... (8 Replies)
Discussion started by: sam127
8 Replies

7. Shell Programming and Scripting

Sorting a .csv using awk or other

Hello all, I am new here and *relatively* new to Unix. I have a bit of an emergency. I have a three column file that I need to sort: sample name, miRNA, reads per million (RPM) There are multiple samples, and for each sample name there are multiple miRNAs and associated RPMs. Some of these... (6 Replies)
Discussion started by: dunnybocter
6 Replies

8. Shell Programming and Scripting

Sorting within a record using AWK

Hello, I have a file which has the following format: I have to do is sort individual records in the file based on the 4th field. Each record starts with "Module". Is there an easy way to do this using awk. I have tried piping output from awk to sort and also using "sort" inside awk but... (8 Replies)
Discussion started by: fifteate
8 Replies

9. Shell Programming and Scripting

Sorting output of AWK array

I need help to sort the output of an awk array Example datadata="1 blue 2 green 3 blue 4 yellow 5 blue 6 red 7 yellow 8 red 9 yellow 10 yellow 11 green 12 orange 13 black" My awk line to get output in one lineecho "$data" | awk ' {arr++; next} END { for (i in arr) { if(arr>1 )... (2 Replies)
Discussion started by: Jotne
2 Replies

10. Shell Programming and Scripting

Help with awk sorting with different values

Hello, I have a file as follows: BTA Pos KLD 4 79.7011 5.7711028907 4 79.6231 5.7083918219 5 20.9112 4.5559494707 5 58.0002 3.4423546273 6 38.2569 4.7108176788 6 18.3889 7.3631759258 (1 Reply)
Discussion started by: Homa
1 Replies
SLAPO-VALSORT(5)						File Formats Manual						  SLAPO-VALSORT(5)

NAME
slapo-valsort - Value Sorting overlay to slapd SYNOPSIS
/etc/openldap/slapd.conf DESCRIPTION
The Value Sorting overlay can be used with a backend database to sort the values of specific multi-valued attributes within a subtree. The sorting occurs whenever the attributes are returned in a search response. Sorting can be specified in ascending or descending order, using either numeric or alphanumeric sort methods. Additionally, a "weighted" sort can be specified, which uses a numeric weight prepended to the attribute values. The weighted sort is always performed in ascending order, but may be combined with the other methods for values that all have equal weights. The weight is specified by prepending an integer weight {<weight>} in front of each value of the attribute for which weighted sorting is desired. This weighting factor is stripped off and never returned in search results. CONFIGURATION
These slapd.conf options apply to the Value Sorting overlay. They should appear after the overlay directive. valsort-attr <attribute> <baseDN> (<sort-method> | weighted [<sort-method>]) Configure a sorting method for the specified attribute in the subtree rooted at baseDN. The sort-method may be one of alpha-ascend, alpha-descend, numeric-ascend, or numeric-descend. If the special weighted method is specified, a secondary sort-method may also be specified. It is an error to specify an alphanumeric sort-method for an attribute with Integer or NumericString syntax, and it is an error to specify a numeric sort-method for an attribute with a syntax other than Integer or NumericString. EXAMPLES
database bdb suffix dc=example,dc=com ... overlay valsort valsort-attr member ou=groups,dc=example,dc=com alpha-ascend FILES
/etc/openldap/slapd.conf default slapd configuration file SEE ALSO
slapd.conf(5), slapd-config(5). ACKNOWLEDGEMENTS
This module was written in 2005 by Howard Chu of Symas Corporation. The work was sponsored by Stanford University. OpenLDAP 2.4.28 2011/11/24 SLAPO-VALSORT(5)
All times are GMT -4. The time now is 11:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy