1849927 Members
3278 Online
104047 Solutions
New Discussion

Edit

 
SOLVED
Go to solution
j773303
Super Advisor

Edit

The data file size is 500,0000 raws, How to truncate to 400,0000 raws? I wish to delete
from 1 raw to 100,0000 raws, which command can do this?
Hero
6 REPLIES 6
Rajeev  Shukla
Honored Contributor
Solution

Re: Edit

Have a look at man pages of "split" command
That will solve your purpose
j773303
Super Advisor

Re: Edit

Coulu you please tell me a sample about how split usage? Thanks!
Hero
Rajeev  Shukla
Honored Contributor

Re: Edit

I am sorry i realised later that you are talking about datafiles. Split actually does in bytes i.e in different sizes of files, i couldn't get it going with split.
and do raws means rows and the files are database files like oracle, the only way you could do is write a sql statement to drop the rows
Otherwise there is nothing you can do with datafiles than writing a c program, dearing the lines and use truncate() function
T G Manikandan
Honored Contributor

Re: Edit

Please explain what u need
Michael Schulte zur Sur
Honored Contributor

Re: Edit

Hi,

tail -400000 datfile > newdatafile
is that, what you where looking for?

Michael
Massimo Bianchi
Honored Contributor

Re: Edit

if you are talking about a oracle database table:


delete from schema.table where rownum < 400.000;

This can take much to complete.

if you are talking about an ascii file:

split -l 100000 yourfilename splitted_filename

will generate 5 file, named splitted_filename.xaa .xab .xac

keep the last, should be splitted_filename.xae, rename it as your original file and you have done it.

Massimo