05-16-2013
Sort data by date and then search by column
Hi,
I have a file where data is pipe separated.First i want to sort the file content by date . Then i want to pick up the records based on the first column which should be unique and not have duplicates.
NYSE|yyyrrrddd|toronto|isin|ticker|2013-05-15
UKS|yyyrrrddd|toronto|isin|ticker|2013-05-14
BSE|yyyrrrddd|toronto|isin|ticker|2013-05-13
HKS|yyyrrrddd|toronto|isin|ticker|2013-05-14
TSX|yyyrrrddd|toronto|isin|ticker|2013-05-16
NYSE|yyyrrrddd|toronto|isin|ticker|2013-05-15
BSE|yyyrrrddd|toronto|isin|ticker|2013-05-15
First i would like to sort by date and get the latest ones. Secondly there should be no duplicates and hence my output should be like this :
TSX|yyyrrrddd|toronto|isin|ticker|2013-05-16
NYSE|yyyrrrddd|toronto|isin|ticker|2013-05-15
BSE|yyyrrrddd|toronto|isin|ticker|2013-05-15
UKS|yyyrrrddd|toronto|isin|ticker|2013-05-14
UKS|yyyrrrddd|toronto|isin|ticker|2013-05-14
Any help with the relevant script is requested.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Everyone,
1.txt
00:00:00 0 0 0 0 0 0 0
00:00:01 0 0 0 2 1 33 2
00:00:02 5 0 0 0 0 0 0
00:00:03 0 4 0 0 0 0 0... (5 Replies)
Discussion started by: jimmy_y
5 Replies
2. Programming
hi all,
could anyone help me?
I need to query output by compare dates from 2 table and i'm using a UNION query..and wanted to sort the output by date..
My query like this:
SELECT
TO_CHAR(DATE) DATE1,
INVOICE
FROM ACCOUNT1
WHERE DATE < (to_date('122003','MMYYYY'))
UNION ... (2 Replies)
Discussion started by: kate katherine
2 Replies
3. Shell Programming and Scripting
Hi, I need somebody's help with sorting data with awk.
I've got a file:
10 aaa 4584
12 bbb 6138
20 ccc 4417
21 ddd 7796
10 eee 7484
12 fff ... (5 Replies)
Discussion started by: killerbee
5 Replies
4. Shell Programming and Scripting
hI
I have file A
NSU30504 5 6 G 6
NSU3050B T 7 9 J
NSU30506 T I 8 9
NSU3050C H J K L Output:
NSU3050B T 7 9 J
NSU3050C H J K L
NSU30504 5 6 G 6
NSU30506 T I 8 9Video tutorial on how to use code tags in The UNIX and Linux Forums. (13 Replies)
Discussion started by: pareshkp
13 Replies
5. Shell Programming and Scripting
Hi. I am not sure the title gives an optimal description of what I want to do. Also, I tried to post this in the "UNIX for Dummies Questions & Answers", but it seems no-one was able to help out.
I have several text files that contain data in many columns. All the files are organized the same... (14 Replies)
Discussion started by: JamesT
14 Replies
6. Shell Programming and Scripting
Hi ,
I have below data inside a file named ref.psv . I want to create a shell script which will do the below 2 points :
(1) sort the file content first based on the latest date which is the last column in the file (actual file its the 175th column)
(2)after sorting the file based on latest date... (3 Replies)
Discussion started by: samrat dutta
3 Replies
7. Shell Programming and Scripting
Hello people,
I am having problem to sort, sed and zero padding of column in csv file.
7th column only.
Input of csv file:
1,2,3,4,5,6,4/1/2010 12:00 AM,8
1,2,3,4,5,6,3/11/2010 9:39 AM,8
1,2,3,4,5,6,5/12/2011 3:43 PM,8
1,2,3,4,5,6,12/20/2009 7:23 PM,8
Output:... (5 Replies)
Discussion started by: sean1357
5 Replies
8. Shell Programming and Scripting
Hi,
i "tried" to sort data by date. So far, i used sed to take the data from the last and the actual month. Now, after changing the year it is not working properly.
i use:
GNU bash, version 4.2.45(1)-release (x86_64-suse-linux-gnu)
sed -n '/\//p' $Home/../scripte/pd_0.txt
y is a... (6 Replies)
Discussion started by: IMPe
6 Replies
9. Shell Programming and Scripting
Input File
Contig_1_294435nt 242231 242751
Contig_1_294435nt 242390 242782
Contig_1_294435nt 242390 242782
Contig_1_294435nt 291578 291668
Contig_2_242278nt 75910 76271
Contig_2_242278nt 76036 76316
Contig_2_242278nt 76036 76316... (2 Replies)
Discussion started by: perl_beginner
2 Replies
10. UNIX for Beginners Questions & Answers
Can i use 'column' command to get the required 3rd column output?
Input example:
1 2 345678 90
2 2 356 42
3 3 8265 55
Output required:
1 2 345678 90
2 2 356 42
3 3 8265 55
Basically i want the 3rd column to be justified to the right, instead of left.... (3 Replies)
Discussion started by: nurul_nadzirah
3 Replies
LEARN ABOUT OSF1
recvstats
RECVSTATS(8) System Manager's Manual RECVSTATS(8)
NAME
recvstats - summarize HylaFAX receive accounting information
SYNOPSIS
/usr/sbin/recvstats [ options ] [ files ]
DESCRIPTION
recvstats is a command script that prints a summary of the HylaFAX accounting statistics for received facsimile. The statistics can be
sorted using one of several keys: the caller's CSI (default), CIDName (CallID2), CIDNumber (CallID1), the communication speed, or the com-
munication data format. Statistics are read from the file /var/spool/hylafax/log/xferfaxlog unless filenames are specified on the command
line.
The following table is an example of the output from recvstats (using the default sort key):
Sender CIDName CIDNumber Pages Time Pg/min Errs TypRate TypData
61 30:47 2.0 16 9600 1-DMR
+13037904674 5 1:34 3.2 2 9600 1-DMH
+14159657824 1 1:00 1.0 0 9600 1-DMH
+15086636852 2 0:00 2.0 0 9600 1-DMH
+15105268781 740 5:47:51 2.1 59 9600 1-DMH
+15105287164 20 7:00 2.9 0 9600 1-DMH
+15123713545 3 1:19 2.3 0 9600 1-DMH
+15123713641 5 1:04 4.6 0 9600 1-DMH
+16099211926 3 2:00 1.5 0 9600 1-DMH
+17088987617 1 0:18 3.3 0 9600 1-DMH
415 390 6175 22 6:01 3.6 0 9600 1-DMH
415 965 7651 56 34:52 1.6 14 9600 1-DMH
415 973 6723 1 2:09 0.5 0 9600 2-DMR
49 211 161514 1 0:00 1.0 0 9600 2-DMR
8185970503 1 0:28 2.1 0 9600 2-DMR
ALDUS CORPORATION ALDUS CO 5551212 3 2:34 1.2 0 9600 1-DMH
--------------------------------------------------------------------------------------------------
Total 925 7:19:03 2.1 91
The Sender column shows the caller's TSI (notice that some callers have not setup a TSI). The CIDName column is the received CIDName value
for the sender. The CIDNumber column is the received CIDNumber value for the sender. The Pages column is the total number of good pages
received. The time column shows the total amount of time spent receiving facsimile from a sender. The Pg/min column displays the average
transfer rate. The Errs column indicates how many protocol errors were encountered while receiving facsimile. The TypRate column displays
the most common communication speed with which facsimile were received. The TypData column shows the most common data format in which fac-
simile data were received.
OPTIONS
-age days Show information only for the facsimile received in the last specified number of days.
-csi* Sort output by caller's CSI.
-cidname Sort output by CIDName
-cidnumber Sort output by CIDNumber
-format Sort output by data format.
-send* Sort output by sender (i.e. caller's CSI).
-speed Sort output by signalling rate.
-since time Show information only for the facsimile received since the specified time; where time is of the form ``MM/DD/YY HH:MM'' (the
date(1) format string %D %H:%M).
-end time Show information only for the facsimile received before the specified time; where time is of the same form as since.
FILES
/var/spool/hylafax spooling area
/var/spool/hylafax/log/xferfaxlog default file from which to read statistics
SEE ALSO
faxq(8), xferfaxstats(8), hylafax-log(5)
March 3, 1995 RECVSTATS(8)