- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sorting in UX
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 04:14 PM
08-29-2002 04:14 PM
The input is;
CIMCCV001;Dec 30, 1999;13:25:51;Dec 30, 1999;13:25:51
CIMCCV002;Jan 12, 2000;06:47:21;Jan 12, 2000;06:47:21
CSICCD002;Dec 29, 1999;03:38:12;Dec 29, 1999;03:41:00
CSICCD002;Dec 31, 1999;04:00:44;Dec 30, 1999;04:32:44
CSICSY000;Jan 3, 2000;12:05:30;Jan 3, 2000;12:06:11
CSICSY001;Jan 4, 2000;12:05:45;Jan 4, 2000;12:06:22
CSICSY002;Jan 2, 2000;12:06:24;Jan 2, 2000;12:06:24
output should be;
CSICCD002;Dec 29, 1999;03:38:12;Dec 29, 1999;03:41:00
CIMCCV001;Dec 30, 1999;13:25:51;Dec 30, 1999;13:25:51
CSICCD002;Dec 31, 1999;04:00:44;Dec 30, 1999;04:32:44
CSICSY002;Jan 2, 2000;12:06:24;Jan 2, 2000;12:06:24
CSICSY000;Jan 3, 2000;12:05:30;Jan 3, 2000;12:06:11
CSICSY001;Jan 4, 2000;12:05:45;Jan 4, 2000;12:06:22
CIMCCV002;Jan 12, 2000;06:47:21;Jan 12, 2000;06:47:21
Thanks ~jdk
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 04:18 PM
08-29-2002 04:18 PM
Re: sorting in UX
Output should be;
CIMCCV001;Dec 30, 1999;13:25:51;Dec 30, 1999;13:25:51
CIMCCV002;Jan 12, 2000;06:47:21;Jan 12, 2000;06:47:21
CSICCD002;Dec 29, 1999;03:38:12;Dec 29, 1999;03:41:00
CSICCD002;Dec 31, 1999;04:00:44;Dec 30, 1999;04:32:44
CSICSY000;Jan 3, 2000;12:05:30;Jan 3, 2000;12:06:11
CSICSY001;Jan 4, 2000;12:05:45;Jan 4, 2000;12:06:22
CSICSY002;Jan 2, 2000;12:06:24;Jan 2, 2000;12:06:24
~jdk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 04:32 PM
08-29-2002 04:32 PM
Re: sorting in UX
You input from message 1 and the output from message 2 are indentical....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 04:46 PM
08-29-2002 04:46 PM
Re: sorting in UX
The first line should end up being the fifth line on output.
input;
CSICCD002;Jan 3, 2000;12:05:30;Jan 3, 2000;12:06:11
CIMCCV001;Dec 30, 1999;13:25:51;Dec 30, 1999;13:25:51
CIMCCV002;Jan 12, 2000;06:47:21;Jan 12, 2000;06:47:21
CSICCD002;Dec 29, 1999;03:38:12;Dec 29, 1999;03:41:00
CSICCD002;Dec 31, 1999;04:00:44;Dec 30, 1999;04:32:44
CSICSY000;Jan 3, 2000;12:05:30;Jan 3, 2000;12:06:11
CSICSY001;Jan 4, 2000;12:05:45;Jan 4, 2000;12:06:22
CSICSY002;Jan 2, 2000;12:06:24;Jan 2, 2000;12:06:24
output;
CIMCCV001;Dec 30, 1999;13:25:51;Dec 30, 1999;13:25:51
CIMCCV002;Jan 12, 2000;06:47:21;Jan 12, 2000;06:47:21
CSICCD002;Dec 29, 1999;03:38:12;Dec 29, 1999;03:41:00
CSICCD002;Dec 31, 1999;04:00:44;Dec 30, 1999;04:32:44
CSICCD002;Jan 3, 2000;12:05:30;Jan 3, 2000;12:06:11
CSICSY000;Jan 3, 2000;12:05:30;Jan 3, 2000;12:06:11
CSICSY001;Jan 4, 2000;12:05:45;Jan 4, 2000;12:06:22
CSICSY002;Jan 2, 2000;12:06:24;Jan 2, 2000;12:06:24
~jdk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 04:55 PM
08-29-2002 04:55 PM
Re: sorting in UX
cat file1 | sort -u >file2
HTH
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 05:11 PM
08-29-2002 05:11 PM
Re: sorting in UX
Try this:
# sort -t\; -k1,9 -kb2.9,2.12 -kM2,3 -kb2.5,2.6 -k3 filein > fileout
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 05:55 PM
08-29-2002 05:55 PM
Re: sorting in UX
outputs;
CSICSY001 9-Nov-2000 18:00:46 9-Nov-2000 18:01:25
CSICSY001 9-Oct-1999 12:46:12 9-Oct-1999 12:46:46
CSICSY001 9-Oct-2000 18:00:46 9-Oct-2000 18:01:19
CSICSY001 9-Sep-1999 18:24:06 9-Sep-1999 18:24:41
CSICSY001 9-Sep-2000 12:47:10 9-Sep-2000 12:47:43
CSICSY002 1-Apr-2000 12:00:34 1-Apr-2000 12:00:34
CSICSY002 1-Aug-2000 18:02:46 1-Aug-2000 18:02:46
But I need to gather them by year, as well as the first column
CSICSY001 9-Sep-1999 18:24:06 9-Sep-1999 18:24:41
CSICSY001 9-Oct-1999 12:46:12 9-Oct-1999 12:46:46
CSICSY001 9-Sep-2000 12:47:10 9-Sep-2000 12:47:43
CSICSY001 9-Oct-2000 18:00:46 9-Oct-2000 18:01:19
CSICSY001 9-Nov-2000 18:00:46 9-Nov-2000 18:01:25
CSICSY002 1-Apr-2000 12:00:34 1-Apr-2000 12:00:34
CSICSY002 1-Aug-2000 18:02:46 1-Aug-2000 18:02:46
Thanks again! ~jdk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:11 PM
08-29-2002 06:11 PM
Re: sorting in UX
You've presented a differnt input format, so applying the 'sort' I suggested in my first post will *not* do as you first asked.
I suggest you look at the man page for 'sort'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:36 PM
08-29-2002 06:36 PM
Re: sorting in UX
Can we try this one more time?
input:
CSICSY001 Nov 9, 2000 18:00:46 9-Nov-2000 18:01:25
CSICSY001 Oct 9, 1999 12:46:12 9-Oct-1999 12:46:46
CSICSY001 Oct 9, 2000 18:00:46 9-Oct-2000 18:01:19
CSICSY001 Sep 19, 1999 18:24:06 9-Sep-1999 18:24:41
CSICSY001 Sep 9, 2000 12:47:10 9-Sep-2000 12:47:43
output;
CSICSY001 Sep 19, 1999 18:24:06 9-Sep-1999 18:24:41
CSICSY001 Oct 9, 1999 12:46:12 9-Oct-1999 12:46:46
CSICSY001 Sep 9, 2000 12:47:10 9-Sep-2000 12:47:43
CSICSY001 Oct 9, 2000 18:00:46 9-Oct-2000 18:01:19
CSICSY001 Nov 9, 2000 18:00:46 9-Nov-2000 18:01:25
~jdk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 06:41 PM
08-29-2002 06:41 PM
Re: sorting in UX
I'll look at sort again in the morning.......sorry for the waste of time :( ~jdk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2002 07:27 PM
08-29-2002 07:27 PM
SolutionCreate a file called sortdate.pl to hold a smal perl script-
BEGIN{@d{qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/}=(1,2,3,4,5,6,7,8,9
,10,11,12);}
{chop;split;($dd,$mth,$yy)=split("-",$_[5]);
printf "%4d%2.2d%2.2d%8s %s\n",$yy,$d{$mth},$dd,$_[6],$_;
}
Then you can do the following-
cat inputfile | perl -n sortdate.pl | sort -kn1,1 | cut -f 2- >outputfile
Hope this helps...
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2002 06:54 AM
08-30-2002 06:54 AM
Re: sorting in UX
While asking you guys the "sort" question, a "helper" was importing and exporting the file to/from Excell and saving the results in the UX system under the original name.
The Excell activity had changed the date format!
Man, I knew I was tired last night, but I thought I was loosing it!.
A restore, and the use of your scripts did the trick!
Thanks again for all the help,
I promise to do some serious looking at the "sort" man page.
Have a GREAT weekend!
~jdk