Hello,
I have this sample data:
how can I sort these entries so that field 2 will be sorted with "*" first followed by numbers where 6 and 06 fill follow each other?
When I try :
the data is sorted numerically yet the field 2 with "*" are not all grouped together.
If I try
then all the "*" in field 2 are properly grouped but 06 and 6 are considered different.
Can you help?
Thanks.
Hi all.
I have 2 files like this:
f1
A 10
B 80
C 9
f2
A 11
B 700
C 10
What I want is the concatenation of the two files sorted by name (alphabetically) and size (numerically), so the result should be like this:
F3 (cat f1 f2 sorted)
A 10
A 11
B 80
B 700 (2 Replies)
I got a long list of file name.
My input:
data_1.txt
data_2.txt
data_3.txt
data_10.txt
data_21.txt
data_12.txt
data_4.txt
My desired output:
data_1.txt
data_2.txt
data_3.txt
data_4.txt
data_10.txt
data_12.txt
data_21.txt
Does anybody got idea how to archive it? (11 Replies)
So, I will be working with someone and basically we are trying to build a form that is submitted most likely via the web and the data is just a string of numbers.
like:
19383882872201110929282821818182827349190102837364718191001932873711
Now, each number is part of a numerical value of... (4 Replies)
Hi,
A basic query. In the example file below, I want to sort by column 1 and then by column 2 numerically. I have tried sort -k2n,1 file1 but while this sorts the columns in the correct order, it does not sort column 2 numerically. Any help would be much appreciated. Also, if you have time to... (3 Replies)
Greetings - I'm not necessarily new to bash scripting - I'm probably between beginner and intermediate, but I have something that I just cannot figure out after many attempts to find it. I have a file that is merely a list of many files, with their respective paths, and a branch path (ClearCase)... (5 Replies)
I have a column of numbers in the following format:
1.722e-05
2.018e-05
2.548e-05
2.747e-05
7.897e-05
4.016e-05
4.613e-05
4.613e-05
5.151e-05
5.151e-05
5.151e-05
6.1e-05
6.254e-05
7.04e-05
7.12e-05
7.12e-05 (6 Replies)
Hello all,
I have a list of file names in a text document where each file name consists of 4 letters and 3 numbers (for example MACR119). There are 48 file names in the document (they are not in alphabetical or numerical order). I would like to reorder the list of names so that the 48th name is... (3 Replies)
How to sort the following output based on lowest to highest BE?
The following sort does not work.
$ sort -t. -k1,1n -k2,2n bfd.txt
BE31.116 0s 0s DOWN DAMP
BE31.116 0s 0s DOWN DAMP
BE31.117 0s 0s ... (7 Replies)
Trying to sort a bunch of files numerically but can't seem to get the command just right. This is in a IBM AIX machine.
I have a directory that has...
backup.bk1
backup.bk100
backup.bk2
backup.bk200
backup.bk3
backup.bk300
There are a lot more files but this is shortened for the... (5 Replies)
Discussion started by: c3rb3rus
5 Replies
LEARN ABOUT DEBIAN
sort-dctrl
SORT-DCTRL(1) Debian user's manual SORT-DCTRL(1)NAME
sort-dctrl - sort Debian control files
SYNOPSIS
sort-dctrl [options] [ file ... ]
sort-dctrl --copying | --help | --version | -ChV
DESCRIPTION
The sort-dctrl program sorts Debian control files according to specified criteria.
A Debian control (dctrl) file is a semistructured single-table database stored in a machine-parseable text file. Such a database consists
of a set of records; each record is a mapping from field names to field content. Textually, records are separated by empty lines, while
each field is encoded as one or more nonempty lines inside a record. A field starts with its name, followed by a colon, followed by the
field content. The colon must reside on the first line of the field, and the first line must start with no whitespace. Subsequent lines,
in contrast, always start with linear whitespace (one or more space or tab characters).
The sort-dctrl program recognizes two field types: string fields and version fields. Version fields act also as numeric fields. String
fields are compared according to strict lexicographical octet-by-octet comparison, after ignoring any initial whitespace after the colon.
Version fields are parsed and compared as Debian version numbers. When comparing version numbers, if a field content does not in fact con-
form to the version number syntax, it compares less than any field content that does conform, and equal to any other nonconforming field
content. The sort-dctrl program assumes all fields are string fields unless told otherwise.
You can specify arbitrary number of keys for sorting, using the -k option. The keys are interpreted in a descending order of priority: the
first key specified is primary, the second key specified is secondary, and so on. If two records compare equal under the primary key, then
they are compared under the secondary key, and so on. If no keys are specified, a default key is assumed (the "Package" field with no mod-
ifiers).
OPTIONS -k keyspec, --key-spec=keyspec
Specify one or more keys for sorting. You may specify this option any number of times. The keyspec argument consists of a comma-
separated list of key specifications. Each key specification consists of the name of the field that serves as the key, optionally
followed by a colon and key modifiers. The following key modifiers are supported:
r Invert the comparison for this key, reversing the sorting order.
v Treat this field as a version number field.
n Treat this field as numeric, which currently is synonymous with v.
-q, --quiet, --silent
Output nothing to the standard output stream. Instead, exit immediately after finding the first match.
-l level, --errorlevel=level
Set log level to level. level is one of fatal, important, informational and debug, but the last may not be available, depending on
the compile-time options. These categories are given here in order; every message that is emitted when fatal is in effect, will be
emitted in the important error level, and so on. The default is important.
-V, --version
Print out version information.
-C, --copying
Print out the copyright license. This produces much output; be sure to redirect or pipe it somewhere (such as your favourite
pager).
-h, --help
Print out a help summary.
EXAMPLES
Here are some sample invocations of the program:
sort-dctrl /var/lib/dpkg/available
Output the dpkg available file sorted by the package name.
sort-dctrl -k Version:v /var/lib/dpkg/available
Output the dpkg available file sorted in ascending order of version numbers.
sort-dctrl -k Version:vr /var/lib/dpkg/available
Output the dpkg available file sorted in descending order of version numbers.
sort-dctrl -k Package,Version:v /var/lib/dpkg/available
Output the dpkg available file sorted primarily in ascending order of package names and secondarily in descending order of version
numbers.
sort-dctrl -k Installed-Size:n,Size:nr /var/lib/dpkg/available
Output the dpkg available file sorted primarily in ascending order of installation sizes and secondarily in descending order of
package sizes.
AUTHOR
The program and this manual page were written by Antti-Juhani Kaijanaho <ajk@debian.org>.
SEE ALSO
Debian Policy Manual. Published as the Debian package debian-policy. Also available in the Debian website.
grep-dctrl(1)Debian Project 2005-06-08 SORT-DCTRL(1)