11-22-2011
Sorting a txt file that is a single column
How do you sort a text file that is made up of a single column? (sorting done in alphabetical order)
Example input:
MAP1S
ISYNA1
STAT6
Example output:
ISYNA1
MAP1S
STAT6
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
Iam trying to sort the contents of the file based on the position of the file.
Example:
$cat sample.txt
0101020060731 ## Header record
1c1 Berger Awc ANP20070201301 4000.50
1c2 Bose W G ANP20070201609 6000.70
1c2 Andy CK ANP20070201230 28000.00... (3 Replies)
Discussion started by: ganapati
3 Replies
2. Shell Programming and Scripting
HI guys,
I have created a script to read 1 column in a csv file and then place it in text file.
However, when i checked out the text file, it is not in a column format...
Example:
CSV file contains
name,age
aa,11
bb,22
cc,33
After using awk to get first column
TXT file... (1 Reply)
Discussion started by: mdap
1 Replies
3. AIX
Helle,
I want to create a .ksh script in order to realize the following :
I have a .txt file organized in a bloc of information, each bloc start with 000 as following:
000...
001...
003...
004...
000...
001...
003...
004...
.
.
My aim is to add a new... (6 Replies)
Discussion started by: zainab2006
6 Replies
4. UNIX for Dummies Questions & Answers
How do you sort a text file that is made up of a single column? (sorting done in alphabetical order)
Example input:
MAP1S
ISYNA1
STAT6
Example output:
ISYNA1
MAP1S
STAT6
Double post (0 Replies)
Discussion started by: evelibertine
0 Replies
5. Shell Programming and Scripting
I have a tab delimited file with 5 columns
79 A B 20.2340 6.1488 8.5086 1.3838
87 A B 0.1310 0.0382 0.0054 0.1413
88 A B 46.1651 99.0000 21.8107 0.2203
89 A B 0.1400 0.1132 0.0151 0.1334
114 A B 0.1088 0.0522 0.0057 0.1083
115 A B... (2 Replies)
Discussion started by: Lucky Ali
2 Replies
6. UNIX for Dummies Questions & Answers
I would like to sort a tab delimited text file based on the absolute value of its second column. How do I go about doing that? Thanks!
Example input:
A -12
B 0
C -6
D 7
Output:
A -12
D 7
C -6
B 0 (4 Replies)
Discussion started by: evelibertine
4 Replies
7. Shell Programming and Scripting
Hi,
I use UBUNTU 12.04.
I have a file with this structure:
Name 2 1245787 A G 12 14 12 14 ....
Name 1 1245789 C T 13 12 12 12.....
I would like to sort my file based on the second column so to have this output for example:
Name 1 1245789 C T 13 12 12 12.....
Name 2 1245787 A G 12 14... (4 Replies)
Discussion started by: Homa
4 Replies
8. Shell Programming and Scripting
Hello,
I have two files as the following:
File1:
F0100020 A G
F0100030 A T
F0100040 A G
File2:
F0100040 A G BTA-28763-no-rs 77.2692
F0100030 A T BTA-29334-no-rs 11.4989
F0100020 A G BTA-29515-no-rs 127.006
I want to sort the second file based on the... (6 Replies)
Discussion started by: Homa
6 Replies
9. Shell Programming and Scripting
Hi,
I have 2 csv/txt files with single columns. I am trying to merge them using paste, but its not working..
output3.csv:
flowerbomb
everlon-jewelry
sofft
steve-madden
dolce-gabbana-watchoutput2.csv:
http://www1.abc.com/cms/slp/2/Flowerbomb
http://www1.abc.com/cms/slp/2/Everlon-Jewelry... (5 Replies)
Discussion started by: ajayakunuri
5 Replies
10. Shell Programming and Scripting
Hi I want to read a text file and replace various number of spaces between each string in to a single "," or any other character .Please let me know the command to do so. My input file is a txt file which is the output of a SQL table extract so it contains so many spaces between each column of the... (2 Replies)
Discussion started by: Hari Prasanth
2 Replies
LEARN ABOUT SUSE
gtk2::treesortable
Gtk2::TreeSortable(3) User Contributed Perl Documentation Gtk2::TreeSortable(3)
NAME
Gtk2::TreeSortable
HIERARCHY
Glib::Interface
+----Gtk2::TreeSortable
METHODS
$sortable->set_default_sort_func ($sort_func, $user_data=undef)
o $sort_func (scalar)
o $user_data (scalar)
boolean = $sortable->has_default_sort_func
$sortable->sort_column_changed
(sort_column_id, order) = $sortable->get_sort_column_id
Returns sort_column_id, an integer and order, a Gtk2::SortType.
$sortable->set_sort_column_id ($sort_column_id, $order)
o $sort_column_id (integer)
o $order (Gtk2::SortType)
$sortable->set_sort_func ($sort_column_id, $sort_func, $user_data=undef)
o $sort_column_id (integer)
o $sort_func (scalar)
o $user_data (scalar)
IMPLEMENTING THE GtkTreeSortable INTERACE
If you want your custom tree model to be sortable, you need to implement the GtkTreeSortable interface. Just like with other interfaces,
this boils down to announcing that your subclass implements the interface and providing a few virtual methods. The former is achieved by
adding "Gtk2::TreeSortable" to the "interfaces" key. For example:
package MyModel;
use Gtk2;
use Glib::Object::Subclass
Glib::Object::,
interfaces => [ Gtk2::TreeModel::, Gtk2::TreeSortable:: ],
;
The virtual methods you need to implement are listed below.
VIRTUAL METHODS
These virtual methods are called by perl when gtk+ attempts to modify the sorting behavior of your model. Implement them in your model's
package. Note that we don't provide a wrapper for sort_column_changed because there is a signal for it, which means you can use the normal
signal overriding mechanism documented in Glib::Object::Subclass.
(is_not_special, id, order) = GET_SORT_COLUMN_ID ($model)
Returns a boolean indicating whether the column is a special or normal one, its id and its sorting order.
SET_SORT_COLUMN_ID ($list, $id, $order)
Sets the sort column to the one specified by $id and the sorting order to $order.
SET_SORT_FUNC ($list, $id, $func, $data)
Sets the function that is to be used for sorting the column $id.
SET_DEFAULT_SORT_FUNC ($list, $func, $data)
Sets the function that is to be used for sorting columns that don't have a sorting function attached to them.
The $func and $data arguments passed to these two methods should be treated as blackboxes. They are generic containers for some
callback that is to be invoked whenever you want to compare two tree iters. When you call them, make sure to always pass $data. For
example:
$retval = $func->($list, $a, $b, $data);
bool = HAS_DEFAULT_SORT_FUNC ($list)
Returns a bool indicating whether $list has a default sorting function.
SIGNALS
sort-column-changed (Gtk2::TreeSortable)
ENUMS AND FLAGS
enum Gtk2::SortType
o 'ascending' / 'GTK_SORT_ASCENDING'
o 'descending' / 'GTK_SORT_DESCENDING'
SEE ALSO
Gtk2, Glib::Interface
COPYRIGHT
Copyright (C) 2003-2008 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
perl v5.12.1 2010-07-05 Gtk2::TreeSortable(3)