Sponsored Content
Top Forums Shell Programming and Scripting sort with different delimiters Post 302579434 by oldman2 on Monday 5th of December 2011 05:34:09 PM
Old 12-05-2011
Thanks for the reply. I tried but it seems AIX does not have a month option for sort. Do you have any idea for the month?

Code:
$ sort -k4.8,4.11 -k4.4,4.6M -k4.1,4.2 -k4.13,4.14 -k4.16,4.17 -k4.19,4.20 myfile
Usage:   sort   [-Abcdfimnru] [-T Directory] [-t Character] [-o File]
                [-y[Kilobytes]] [-z Recordsize] [-k Keydefinition]...
                [[+Position1][-Position2]]... [File]...
$ sort -k4.8,4.11 -k4.4,4.6m -k4.1,4.2 -k4.13,4.14 -k4.16,4.17 -k4.19,4.20 myfile
Usage:   sort   [-Abcdfimnru] [-T Directory] [-t Character] [-o File]
                [-y[Kilobytes]] [-z Recordsize] [-k Keydefinition]...
                [[+Position1][-Position2]]... [File]...
$ sort -k4.8,4.12 -k4.1,4.2 -k4.12,4.20 myfile
Inbound5:remote - - 01/Dec/2010:08:31:42 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound5:remote - - 10/Dec/2010:08:31:42 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound5:remote - - 11/Dec/2010:08:31:42 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound5:remote - - 12/Dec/2010:08:31:42 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 01/Oct/2011:08:20:21 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 01/Oct/2011:08:20:22 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 01/Oct/2011:08:21:21 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound1:remote - - 01/Nov/2011:08:29:51 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound3:remote - - 01/Oct/2011:08:29:52 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound4:remote - - 02/Oct/2011:08:29:52 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound9:remote - - 02/Nov/2011:08:29:51 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound1:remote - - 02/Dec/2011:08:31:42 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound6:remote - - 01/Dec/2011:08:31:42 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 01/Oct/2011:09:20:21 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 01/Oct/2011:09:20:22 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 02/Oct/2011:09:20:22 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 02/Oct/2011:09:20:23 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 02/Oct/2011:09:20:24 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 02/Oct/2011:09:20:25 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 03/Oct/2011:09:20:22 -0500 "GET / HTTP/1.1" 404 2098 HTTP
Inbound7:remote - - 01/Oct/2011:09:21:21 -0500 "GET / HTTP/1.1" 404 2098 HTTP

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delimiters missing

Hi I have a pipe-delimited file where I eventually need to replace a string stored on the 3th field on a specific record. This is how the file looks like: A|Mike|Lvl 1|... B|... A|Maria|Lvl 1|... C|... B|... A|Jimmy|Lvl 2|... C|... A|Carry|Lvl 0|... C|... B|... A|John|Lvl 8|...... (2 Replies)
Discussion started by: Indalecio
2 Replies

2. Solaris

To extract everything between two delimiters

My input file looks like " @$SCRIPT/atp_asrmt_adj.sql $SCRIPT/dba2000.scr -s / @$SCRIPT/cim1005w.pls $SCRIPT/dba2000.scr -s / @$SCRIPT/cim1006w.pls start $SCRIPT/cim1020d.sql;^M spool $DATA/cim1021m.sql @$DATA/cim1021m.sql ! rm $DATA/cim1021m.sql spool $DATA/cim1021m.sql... (1 Reply)
Discussion started by: dowsed4u8
1 Replies

3. Shell Programming and Scripting

Problems with delimiters

Hello, I have data in a file something like this - UNB+UNOA:1+006415160:1+AR0000012360:ZZ+080701:0552+2++DELFOR++++T'UNH+2+DELFOR:D:97A:UN Here, the delimiters used are + , : and ' . I have a set of such files in which these delimiters vary from one file to another. I am developing a... (4 Replies)
Discussion started by: The Observer
4 Replies

4. Shell Programming and Scripting

How to Sort Floating Numbers Using the Sort Command?

Hi to all. I'm trying to sort this with the Unix command sort. user1:12345678:3.5:2.5:8:1:2:3 user2:12345679:4.5:3.5:8:1:3:2 user3:12345687:5.5:2.5:6:1:3:2 user4:12345670:5.5:2.5:5:3:2:1 user5:12345671:2.5:5.5:7:2:3:1 I need to get this: user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Discussion started by: daniel.gbaena
7 Replies

5. Shell Programming and Scripting

Split using two delimiters

I'm trying to do a split using two delimiters. The first delimiter is ": " (or we could call it :\s). The second is "\n". How can or these delimiters so I can toss the values into an array without issue? I tried @array = split /:\s|\n/, $myvar; This doesn't seem to be working. Any an... (3 Replies)
Discussion started by: mrwatkin
3 Replies

6. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

7. Shell Programming and Scripting

Help with sort word and general numeric sort at the same time

Input file: 100%ABC2 3.44E-12 USA A2M%H02579 0E0 UK 100%ABC2 5.34E-8 UK 100%ABC2 3.25E-12 USA A2M%H02579 5E-45 UK Output file: 100%ABC2 3.44E-12 USA 100%ABC2 3.25E-12 USA 100%ABC2 5.34E-8 UK A2M%H02579 0E0 UK A2M%H02579 5E-45 UK Code try: sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

9. Shell Programming and Scripting

Inserting Delimiters

Hi Team, I am trying to get the data in below format Jan 01 | 19:00:32 | xyz | abc | sometext | string however I am not sure of the total number strings which can come in the record hence i cant use something like below as it can end $6 or it can go further cat file| awk... (8 Replies)
Discussion started by: rakesh_411
8 Replies

10. Shell Programming and Scripting

Delimiters with awk?

I have a file which is separated by delimiter "|", but the prob is one of my column do contain delimiter as description so how can i differentiate it? PS : the delmiter does have backslash coming before it, if occurring in column Annual|Beleagured|Desc|Denver... (2 Replies)
Discussion started by: nikhil jain
2 Replies
HTTP::Proxy::BodyFilter::htmltext(3pm)			User Contributed Perl Documentation		    HTTP::Proxy::BodyFilter::htmltext(3pm)

NAME
HTTP::Proxy::BodyFilter::htmltext - A filter to transmogrify HTML text SYNOPSIS
use HTTP::Proxy::BodyFilter::tags; use HTTP::Proxy::BodyFilter::htmltext; # could it be any simpler? $proxy->push_filter( mime => 'text/html', response => HTTP::Proxy::BodyFilter::tags->new, response => HTTP::Proxy::BodyFilter::htmltext->new( sub { tr/a-zA-z/n-za-mN-ZA-M/ } ) ); DESCRIPTION
The HTTP::Proxy::BodyFilter::htmltext is a filter spawner that calls the callback of your choice on any HTML text (outside "<script>" and "<style>" tags, and entities). The subroutine should modify the content of $_ as it sees fit. Simple, and terribly efficient. METHODS
The filter defines the following methods, called automatically: init() Ensures that the filter is initialised with a CODE reference. begin() Per page parser initialisation. filter() A simple HTML parser that runs the given callback on the text contained in the HTML data. Please look at HTTP::Proxy::BodyFilter::htmlparser if you need something more elaborate. SEE ALSO
HTTP::Proxy, HTTP::Proxy::BodyFilter, HTTP::Proxy::BodyFilter::htmlparser. AUTHOR
Philippe "BooK" Bruhat, <book@cpan.org>. COPYRIGHT
Copyright 2003-2005, Philippe Bruhat. LICENSE
This module is free software; you can redistribute it or modify it under the same terms as Perl itself. perl v5.12.4 2011-07-03 HTTP::Proxy::BodyFilter::htmltext(3pm)
All times are GMT -4. The time now is 08:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy