• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regular expression for deleting new lines with Ant

 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using the spool command in sqlplus to retrieve some information and put it into a file. Than I want to parse that file for only valid lines not all the other stuff sqlplus stuffs in there. The big problem is the new lines that are littered everywhere and I can't seem to get rid of. The regex I'm using through ant is this ...


There must be something I'm missing ... any ideas?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The match starts with a '^' which matches the beginning of a line. So it would appear that this regex would do a decent job of removing blank lines.

When you say "The big problem is the new lines that are littered everywhere and I can't seem to get rid of." what exactly are you trying to get rid of? The way I read that sentence is that you want to get rid of the new line character (0x0a), or character pair on Windows (0x0d0a). Is that what you mean? Perhaps a simple example would help us understand exactly what you want - in other words, show some file contents before and after processing.
 
Chris Dancy
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Something which looks like the following ...

<blankline>
<blankline>
hello world
<blankline>
<blankline>



for whatever reason ant's regex tasks will not remove those blank lines ... The program that produces this file to parse is sqlplus through the spool command ... that should not matter but just in case it does.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic