If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Copying a specific number of records from one file to another

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-27-03, 14:30
cobilan cobilan is offline
Registered User
 
Join Date: Feb 2003
Posts: 10
Copying a specific number of records from one file to another

I have a huge file containing about 3 million records. I don't want to test using this huge file. I want to pull off the first 100 records from this file. Is there a command I can use to do this or will I have to write a script to do it?

I can use the SPLIT command and eventually get it down to 1000 records, but it takes a while.

Cobilan
Reply With Quote
  #2 (permalink)  
Old 03-27-03, 17:41
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,543
Re: Copying a specific number of records from one file to another

head command .....

man head

should give you more details ..

eg. head -100 bigfile > myfile

Cheers

Sathyaram


Quote:
Originally posted by cobilan
I have a huge file containing about 3 million records. I don't want to test using this huge file. I want to pull off the first 100 records from this file. Is there a command I can use to do this or will I have to write a script to do it?

I can use the SPLIT command and eventually get it down to 1000 records, but it takes a while.

Cobilan
Reply With Quote
  #3 (permalink)  
Old 03-27-03, 19:05
cobilan cobilan is offline
Registered User
 
Join Date: Feb 2003
Posts: 10
Thank you soooooooooo much!!! You've saved me a lot of time!

Cheers!!!

Cobilan
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On