View Single Post
  #2   (View Single Post)  
Old 18th July 2010
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 1,027
Default

I'm not familiar with the conversion issues, and this is just a quick idea of the top of my head, but it seems likely your script may be slow because it's reading and processing the input a line at a time. So, can you work with the input as a whole file?

E.g., copy input to a temp file, apply the file command to that to determine what type it is, then cat the tempfile through the conversion filter or not, as you've done with lines. Then delete the tempfile.

There's probably a neater version of this, which might be worth looking for if this method works at all and gives a good speedup. Hope that helps.
Reply With Quote