[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line length limitations

From: Bruce Korb
Subject: Re: Line length limitations
Date: Wed, 06 Jun 2001 19:47:43 -0700

address@hidden wrote:
> On Wed, Jun 06, 2001 at 01:10:14AM -0300, Alexandre Oliva wrote:
> > On Jun  5, 2001, Robert Boehne <address@hidden> wrote:
> >
> > > So I'm sure how to check the limits under SGI without
> > > the 'wc' command.
> >
> > Use cmp.
> Ok, I wrote a short test script to do what I want. I have made the
> decision not to tie the limit of sed to the command-line length limit
> by having sed take its input from a file rather than a pipe (echo |
> sed). So, I currently append 30 characters at a time to a file and
> have sed strip off the last character. I then cmp this against what
> the correct output should be. The problem with this is that I
> currently use 3 files and it's slow (too many forks):
>   1. /tmp/sed-in (non-newline terminated)
>   2. /tmp/sed-in-nl (newline terminated) because sed wants a NL. We
>      cmp this against /tmp/sed-out.
>   3. /tmp/sed-out (output sed gave us)
> My test script is appended below. If this is the correct course of
> action, I'll work up a patch.

I suggest doing a binary search by doubling the line size
each iteration.  You are correct.  You are spending too much
time inside of the loop.  :-)  Use this in the loop:

  cat /tmp/$$-sed-in /tmp/$$-sed-in > /tmp/$$-sed-tmp
  mv -f /tmp/$$-sed-tmp /tmp/$$-sed-in

reply via email to

[Prev in Thread] Current Thread [Next in Thread]