On Mon, Dec 08, 2003 at 05:51:25PM -0800, homeyra g wrote:

>Here is the question: How to truncate a file from the
>begining to a certain point in the file?

You can do this in vi.  If you are trying to keep only the beginning,
you'd do this, where ++ is the first line you don't want:


If you only want the chunk at the end there are a couple of good ways:


or, if you want to keep the original file:

:++-1,$w newfile

Where newfile is the file name you want to keep your output in.

vi does a whole lot of fine things, and because it is nearly ubiquitous
in UNIX it may be worth using for such things.

If you want to do this from the command line you can do so with ex
scripts.  This is the "use vi for all text processing" approach.  Perl,
sed, awk, shell scripting; they'll all do the same job.  Pick a tool and
you'll get a lot of mileage out of it.  Have fun.



[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to