LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 08: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, 08:47 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
guess what?


man split

google "man split"
 
Old 08-22-2005, 08: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, 08: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, 08:58 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

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


Reply



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 03:33 PM
Create a text file using Bash Boffy Programming 5 03-14-2005 09:06 PM
Need help reading text file in bash script scilec Programming 3 11-25-2004 06:44 PM
Bash script - reading from text file twantrd Programming 4 11-24-2004 12:38 AM
send text to file bash bendeco13 Linux - General 6 11-01-2004 06:26 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:26 PM.

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
Open Source Consulting | Domain Registration