The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need help in splitting the file Vaddadi Shell Programming and Scripting 3 05-23-2008 06:44 AM
File Splitting dncs Shell Programming and Scripting 5 12-06-2007 03:47 AM
[Splitting file] Extracting group of segments from one file to others ozgurgul Shell Programming and Scripting 1 09-14-2006 09:17 AM
File splitting praveen.pinto UNIX for Dummies Questions & Answers 9 02-10-2005 12:32 PM
file splitting praveen.pinto UNIX for Advanced & Expert Users 2 02-10-2005 05:54 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-30-2005
Registered User
 

Join Date: Nov 2005
Posts: 6
splitting file

Dear All,

Here I need some help. I have a file which has 100 lines and I like to split that file into 5 files each containing 20 lines.

so the wc -l bigfile gives me 100 lines. How I will make 5 small files out of this each containing exactly 20 lines:

thanks.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-30-2005
Just Ice's Avatar
Lights on, brain off.
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 627
sounds like homework ... if not, check "man awk" or "man sed" ...
Reply With Quote
  #3 (permalink)  
Old 11-30-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,502
The split command is what you want. try man split.

I agree it sounds like homework to me too.
Reply With Quote
  #4 (permalink)  
Old 11-30-2005
Registered User
 

Join Date: Nov 2005
Posts: 6
Thanks

Guys,
thanks for all the help. It is not a home work although perfectly sounds that way. I have a long sql file which has many individual sql statements like analyze table (one liner). so what we want to do is to break the master script into 5 individual script so we could run 5 sqlplus sessions at a time. However it could be done with other way but this 5 sqlplus sessions is now the interest to my company.

I used stuffs like you guys mentioned: both sed and split:for example:

split -b1024b bigfile and it created a bunch of xxa xxb types which could be renamed to sql file and very well run without trouble.

sed was useful too.

thanks.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0