Heh. I keep getting answers, after all this time. See below for how I
solved it.

Background:

I had a 1.5 gig flatfile, consisting of all the data from two databases.
I had neglected to put 'use <database>' lines in it, so I couldn't
simply load it back into MySQL. I had to add one line at the beginning,
and one line somewhere in the middle. Or so I thought. Here's what I
did.

Step 1: Use 'more' to find what line number the info for the second DB
started on.

Step 2: Use 'head' to grab the first n lines of the file, up to where
the second DB started, and pipe the output to a second file. I now have
the first DB in it's own file.

Step 3: Use 'tail' to grab the last n lines of the file, to get the
second DB. Also pipe this to a file. Now I have each DB in it's own
file.

Step 4: Upload each file on it's own into the server, telling the mysql
client what DB to send the data too.

Done. And all without adding any lines. Maybe this will help someone
else in the future who is in the same situation.

Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-----Original Message-----
From: Thomas Spahni [mailto:[EMAIL PROTECTED]] 
Sent: Friday, February 08, 2002 5:25 AM
To: Matthew Walker
Cc: [EMAIL PROTECTED]
Subject: Re: OT: *nix text editor?

On Mon, 4 Feb 2002, Matthew Walker wrote:

> I need to find a text editor for Linux that doesn’t load the whole
file
> into memory. I need to edit a 1.5 gig text flatfile to add two lines.
> But I don’t have enough ram to open it in most programs. Can anyone
> recommend something?

  man sed

Rather obscure at the beginning but does the job.
(Filter: MySQL database table query)

Thomas Spahni


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.323 / Virus Database: 180 - Release Date: 2/8/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.323 / Virus Database: 180 - Release Date: 2/8/2002
 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to