[RLUG] quick question
Anna
christiana at hipointcoffee.com
Wed Jun 28 18:12:24 PDT 2006
oh, woops. hehe. Missed that part. sorry.
another way of doing it with C might be with mmap() and memmove(). I
know this doesn't add much to the conversation. I'm just curious about
how well it would work.
- Anna
On Wed, Jun 28, 2006 at 05:37:04PM -0700, James Washer wrote:
> But that is NOT "in place"... i.e. when finished, he'll have two copies of the file. If disk space is tight... that won't work.
>
> On Wed, 28 Jun 2006 17:22:18 -0700
> Anna <christiana at hipointcoffee.com> wrote:
>
> > find out which byte terminates the first 300 lines. maybe...
> >
> > ~$ BYTES=$(head -300 nameofbigfile.txt | wc -c)
> >
> > then use that info with dd skip the first part of the input file...
> >
> > ~$ dd if=nameofbigfile.txt of=truncatedversion.pl ibs=$BYTES skip=1
> >
> > one of many ways, I'm sure. I think this way should be pretty fast
> > because it works on a line by line basis for just a small part of the
> > file. The rest, with dd, is done in larger pieces.
> >
> > - Anna
> >
> >
> > On Wed, Jun 28, 2006 at 01:01:03PM -0700, Grant Kelly wrote:
> > > Alright unix fans, who can answer this the best?
> > >
> > > I have a text file, it's about 2.3 GB. I need to delete the first 300
> > > lines, and I don't want to have to load the entire thing into an
> > > editor.
> > >
> > > I'm trying `sed '1,300d' inputfile > output file` but it's taking a
> > > long time (and space) to output everything to the new file.
> > >
> > > There has got to be a better way, a way that can do this in-place...
> > >
> > >
> > > Grant
> > >
> > > _______________________________________________
> > > RLUG mailing list
> > > RLUG at rlug.org
> > > http://lists.rlug.org/mailman/listinfo/rlug
> >
> > _______________________________________________
> > RLUG mailing list
> > RLUG at rlug.org
> > http://lists.rlug.org/mailman/listinfo/rlug
> >
>
> _______________________________________________
> RLUG mailing list
> RLUG at rlug.org
> http://lists.rlug.org/mailman/listinfo/rlug
More information about the RLUG
mailing list