04-07-2014
Hi A-V!
I forgot to use -d, with paste command you can remove tr -s '\t' ',', and replace
final_cmd="paste $arg | tr -s '\t' ','"
with
final_cmd="paste -d, $arg" to simplify code.
This User Gave Thanks to Akshay Hegde For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to sort the 3rd column in ascending order , each and every column are seperated by ~.
sample input file :
2~Lead Time Metrics~jennife1
2~Lead Time Metrics~mmullis
2~Lead Time Metrics~lisah
2~Lead Time Metrics~pros
2~Lead Time Metrics~kenward
can any one help me out .
i... (1 Reply)
Discussion started by: krishnan_6015@y
1 Replies
2. Shell Programming and Scripting
I have almost got my unix program working that im working on as a personal project, my file tvs.txt has around 500 records so this would make it alot easier for me to find specific information.
I have a file called tvs.txt, I'm using pico to edit the files and i want to be able to sort on the a... (6 Replies)
Discussion started by: john123
6 Replies
3. Shell Programming and Scripting
I have a file abc.txt which contains data in th following format
abc,23
hgfh,87
tweg,89
jdfjn,74
I want to sort on the basis of column (the second one). It should be numerical sort.
output should be
abc,23
jdfjn,74
hgfh,87
tweg,89
I know how to do it in unix. I need a PERL code (1 Reply)
Discussion started by: centurion_13
1 Replies
4. Shell Programming and Scripting
Hello all,
Is there a way to sort only one column while keeping everything else intact. Take for example this situation: (all columns are space separated)
11 AA asdf 1 -0.5 xx
11 AA axdf 1 -0.6 xx
11 AA csls 1 -0.7 xx
11 AA hjkj 1 -0.4 xx
11 AA uius 1 -0.8 xx
22 AA asdf 1 -0.4 xx
22 AA... (7 Replies)
Discussion started by: jaysean
7 Replies
5. 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
6. Shell Programming and Scripting
hello,
I have a file as follows:
F0100010 A C F0100040 A G BTA-28763-no-rs 77.2692
F0100020 A G F0100030 A T BTA-29334-no-rs 11.4989
F0100030 A T F0100020 A G BTA-29515-no-rs 127.006
F0100040 A G F0100010 A C BTA-29644-no-rs 7.29827
F0100050 A... (9 Replies)
Discussion started by: Homa
9 Replies
7. UNIX for Dummies Questions & Answers
I am trying to arrange these columns so that they look like this:
Xray2_1255555 Number of Copies: 1
Boxcar_1387305895 Number of Copies: 2
Fox_1387305896 Number of Copies: 2
But I have one column after another like this:
Xray2_1255555
Number of Copies: 1
Xray2_12444444
Number of... (5 Replies)
Discussion started by: newbie2010
5 Replies
8. Shell Programming and Scripting
I am trying to sort, do uniq by 1st column and report this 4 columns tab delimiter table , eg
chr10:112174128 rs2255141 2E-10 Cholesterol, total
chr10:112174128 rs2255141 7E-16 LDL
chr10:17218291 rs10904908 3E-11 HDL Cholesterol
chr10:17218291 rs970548 8E-9 TG... (4 Replies)
Discussion started by: fat
4 Replies
9. Shell Programming and Scripting
What im trying to do is sort the output by the number on the second column and than limit the result to only the first three lines.
This is the code
idlist="x23s52; f34233; 2343xs; 25x34; si342d"
cntr=1
idcnt=$(print $nidlist |tr ';' '\n' |wc -l)
numofgrps=0
while (($cntr <= $idcnt))... (3 Replies)
Discussion started by: ajetangay
3 Replies
10. Shell Programming and Scripting
Hey,
So I'm having issues sorting a data set.
The data set contains entries as such;
# key: sex, time, athlete, athlete's nationality, date, city, country
M, 2:30:57.6, Harry Payne, GBR, 1929-07-05, Stamford Bridge, England
M, 2:5:42, Khalid Khannouchi, MAR, 1999-10-24, Chicago, USA
M,... (1 Reply)
Discussion started by: DNM_UKN
1 Replies
LEARN ABOUT DEBIAN
prima::detailedlist
Prima::DetailedList(3) User Contributed Perl Documentation Prima::DetailedList(3)
NAME
Prima::DetailedList - a multi-column list viewer with controlling header widget.
SYNOPSIS
use Prima::DetailedList;
my $l = $w-> insert( 'Prima::DetailedList',
columns => 2,
headers => [ 'Column 1', 'Column 2' ],
items => [
['Row 1, Col 1', 'Row 1, Col 2'],
['Row 2, Col 1', 'Row 2, Col 2']
],
);
$l-> sort(1);
DESCRIPTION
Prima::DetailedList is a descendant of Prima::ListViewer, and as such provides a certain level of abstraction. It overloads format of items
in order to support multi-column ( 2D ) cell span. It also inserts Prima::Header widget on top of the list, so the user can interactively
move, resize and sort the content of the list. The sorting mechanism is realized inside the package; it is activated by the mouse click on
a header tab.
Since the class inherits Prima::ListViewer, some functionality, like 'item search by key', or "get_item_text" method can not operate on 2D
lists. Therefore, mainColumn property is introduced, that selects the column representing all the data.
API
Events
Sort COLUMN, DIRECTION
Called inside sort method, to facilitate custom algorithms of sorting. If the callback procedure is willing to sort by COLUMN index,
then it must call "clear_event", to signal the event flow stop. The DIRECTION is a boolean flag, specifying whether the sorting must be
performed is ascending ( 1 ) or descending ( 0 ) order.
The callback procedure must operate on the internal storage of "{items}", which is an array of arrays of scalars.
The default action is the literal sorting algorithm, where precedence is arbitrated by "cmp" operator ( see "Equality Operators" in
perlop ) .
Properties
columns INTEGER
Governs the number of columns in items. If set-called, and the new number is different from the old number, both items and headers are
restructured.
Default value: 0
headerClass
Assigns a header class.
Create-only property.
Default value: "Prima::Header"
headerProfile HASH
Assigns hash of properties, passed to the header widget during the creation.
Create-only property.
headerDelegations ARRAY
Assigns a header widget list of delegated notifications.
Create-only property.
headers ARRAY
Array of strings, passed to the header widget as column titles.
items ARRAY
Array of arrays of scalars, of arbitrary kind. The default behavior, however, assumes that the scalars are strings. The data direction
is from left to right and from top to bottom.
mainColumn INTEGER
Selects the column, responsible for representation of all the data. As the user clicks the header tab, "mainColumn" is automatically
changed to the corresponding column.
Default value: 0
Methods
sort [ COLUMN ]
Sorts items by the COLUMN index in ascending order. If COLUMN is not specified, sorts by the last specified column, or by #0 if it is
the first "sort" invocation.
If COLUMN was specified, and the last specified column equals to COLUMN, the sort direction is reversed.
The method does not perform sorting itself, but invokes Sort notification, so the sorting algorithms can be overloaded, or be applied
differently to the columns.
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.
SEE ALSO
Prima, Prima::Lists, Prima::Header, examples/sheet.pl
perl v5.14.2 2009-02-24 Prima::DetailedList(3)