Home » Infrastructure » Unix » Sed or Java
Sed or Java [message #98203] Sat, 08 May 2004 08:55 Go to next message
shruti
Messages: 9
Registered: December 2002
Junior Member
I know there are several ways to search and replace a string in a flat file (parse). I am using sed unix tool to find and replace a string. The file size is one gig so it takes about 40 to 50 mins to do so. I was wondering if a java program would be better than sed. Please need your experience and suggestions.

Thank you,

Shruti.

 

Re: Sed or Java [message #98252 is a reply to message #98203] Fri, 28 May 2004 10:01 Go to previous messageGo to next message
Tak Tang
Messages: 142
Registered: May 2004
Senior Member
Well, sed is written in C. Java is interpreted byte code, which can sometimes be converted into C and compiled to gain speed. On this basis alone, I doubt that Java would be faster, although I have not actually tried it myself.

The speed may be inhibited by disk i/o rather than program efficiency. I'm not sure how to measure this. You could try reading from one disk and writing to a different one.

Takmeister
Re: Sed or Java [message #98254 is a reply to message #98252] Sat, 29 May 2004 00:18 Go to previous message
Tak Tang
Messages: 142
Registered: May 2004
Senior Member
I've had another thought. How long does it take to do a straight copy (ie bypassing sed)? Subtract one from the other gives you the time it took to do processing. 40-50 minutes does sound quite high. If you post your sed script here, with a *textual* description of what you are trying to do, I'll see if I can improve it.

Takmeister
Previous Topic: Need Help!
Next Topic: Urgent
Goto Forum:
  


Current Time: Sun Sep 27 21:48:13 CDT 2020