LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 08-22-2005, 09:38 AM   #1
iluvatar
Member
 
Registered: Jul 2003
Location: netherlands
Distribution: debian
Posts: 403

Rep: Reputation: 30
bash: split text file


Hello everybody,

I have to deal with very large text files (up to 1000000 rows). For the processing of these files, I'd like to split them into smaller pieces (say 10000 rows each). Is there a simple bash command (or bash script) to do such thing?

Thanks in advance,
.-=~ iluvatar ~=-.
 
Old 08-22-2005, 09:47 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,314

Rep: Reputation: 175Reputation: 175
guess what?


man split

google "man split"
 
Old 08-22-2005, 09:47 AM   #3
jxi
Member
 
Registered: Feb 2003
Location: Richmond VA
Distribution: Slackware 11 -- CentOS 4.4
Posts: 115

Rep: Reputation: 15
man split

i think you want the option lines=10000

if you dont specify an output prefix it will put
first 10000 in xaa
second 10000 in xab
and so on...
 
Old 08-22-2005, 09:52 AM   #4
iluvatar
Member
 
Registered: Jul 2003
Location: netherlands
Distribution: debian
Posts: 403

Original Poster
Rep: Reputation: 30
gee I never knew this existed :S sorry for bothering you... and thanks for the awnsers!
 
Old 08-22-2005, 09:58 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,314

Rep: Reputation: 175Reputation: 175
no probs
that's what we log in for!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
split up text file jollyjoice Programming 4 06-10-2005 04:33 PM
Create a text file using Bash Boffy Programming 5 03-14-2005 10:06 PM
Need help reading text file in bash script scilec Programming 3 11-25-2004 07:44 PM
Bash script - reading from text file twantrd Programming 4 11-24-2004 01:38 AM
send text to file bash bendeco13 Linux - General 6 11-01-2004 07:26 PM


All times are GMT -5. The time now is 12:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration