aspose file tools*
The moose likes Linux / UNIX and the fly likes Regular Expression help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Regular Expression help" Watch "Regular Expression help" New topic
Author

Regular Expression help

miki landon
Greenhorn

Joined: Sep 02, 2008
Posts: 5
Hi,

I would like to filter a file with a comma delimiter.

But I have trouble with my regular expression.

For example I have my data from mylog.txt


For example I would like to get the lines only when the 2nd coloumn is more than 06:00:00 am

I've tried


but it doesn't work

Can someone help me?

Thanks,

Can some
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

miki landon wrote:but it doesn't work

ItDoesntWorkIsUseless - please explain what you mean, do you get an error message, if so, what is the error message? What exactly did you expect and how does what actually happens differ from that?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

Grep can't do logical comparisons, only pattern matching. AWK would be a better choice. It would also allow you to to split lines into fields based on separator characters such as commas without the need to set up a massive regex.


Customer surveys are for companies who didn't pay proper attention to begin with.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

if 'more than 6:00' just means, as given in the examples, 06:00 to 06:59 but not 07: or - beware 10:17, you could do it with grep:


even

seems to work, but from there it get's difficult.


http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regular Expression help
 
Similar Threads
Problems with hibernate and mysql?
Why my program works fine when i write Thread.sleep(0)
Java Calendar Dates
HttpConnector[8080] No processor available, rejecting this connection
Java Calendar Dates