Next Question

Mahalo is adding a tip to all questions that don't offer a tip.
M¢25 Funded By Mahalo ? |
November 03, 2009 03:19 AM
RSS
tenasty
You looks you know some Linux - so you're very close.
Source(s):
http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
Permalink | Report
http://www.omgtldr.com/proustr/
A simpler way might be to do one sentence at a time, but the problem is that some sentences are more than 140 characters. If you are interested in the sentence idea I think it would work kind of like this: In MS Word you can do the replace function and replace "period space" with "period space tab" and then export the file into Excel using a tab delimited setting. Then just save it as a CSV for import into MySQL. This would almost give you what you want, but not quite. I know it's an ugly solution, so I'm sure you will find a better one.
Source(s):
http://twitter.com/proustr
http://www.omgtldr.com/proustr/
Permalink | Report
Answered Question

Mahalo is adding a tip to all questions that don't offer a tip.
How to import a book into a database, 140 characters at a time
So here's the deal. I have a huge plain text file (about 650K). I need to chop the book into 140 character sections, and each section needs to be a separate record in a database. Obviously, they should be sequential. Additionally, I would like to keep words whole so if a word crosses 140 characters it won't get chopped up. In the end, this data needs to be in a MySQL database, but any intermediate format is fine (CSV, Excel, Access Database or other) as I can handle moving it from there to the mysql database.
I'm looking for ideas on how to do this without getting to deep into programming. What are your thoughts?
One possiblity is if there were some command I could run from the command line (terminal, OS X) that would take the file and send 140 char chunks out to stdout, then I could just pipe that to a file... but I don't know what command to use.
I'm looking for ideas on how to do this without getting to deep into programming. What are your thoughts?
One possiblity is if there were some command I could run from the command line (terminal, OS X) that would take the file and send 140 char chunks out to stdout, then I could just pipe that to a file... but I don't know what command to use.
Interesting Question?
Yes (0)
No (0)
RSS
Best Answer Chosen by Asker
tenasty
November 04, 2009 06:06 AM
I forgot to mention perl. With perl you should be able to the split and join functions to achieve most of this.
Tip tenasty for this comment
Report
Other Answers (2)
November 03, 2009 06:33 AM
I think VI/VIM is your answer. You looks you know some Linux - so you're very close.
Source(s):
http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
Permalink | Report
November 03, 2009 02:14 PM
It sounds like you are going to do what Proustr is doing: twittering Proust. He basically outlines how he processes the text here: http://www.omgtldr.com/proustr/
A simpler way might be to do one sentence at a time, but the problem is that some sentences are more than 140 characters. If you are interested in the sentence idea I think it would work kind of like this: In MS Word you can do the replace function and replace "period space" with "period space tab" and then export the file into Excel using a tab delimited setting. Then just save it as a CSV for import into MySQL. This would almost give you what you want, but not quite. I know it's an ugly solution, so I'm sure you will find a better one.
Source(s):
http://twitter.com/proustr
http://www.omgtldr.com/proustr/
Permalink | Report
Answer this Question
Related Questions
Ask a Question
Buy Mahalo Dollars with Credit Card or PayPal
Top Members
Most Popular Tags
Categories
- Anonymous
- Arts & Design
- Beauty & Style
- Books & Authors
- Business
- Cars & Transportation
- Consumer Electronics
- Coupons Deals
- Education
- Entertainment
- Environment
- Fitness
- Food & Drink
- From Email
- From Iphone
- From Twitter
- Health
- History
- Hobbies
- Home & Garden
- How Tos
- Humor
- Jobs
- Legal
- Local
- Love & Relationships
- Mahalo Answers Community
- Money
- Music
- News
- NSFW
- Parenting
- Pets
- Science & Mathematics
- Services
- Shopping
- Social Science
- Society & Culture
- Sports
- Technology & Internet
- Travel
- Video Games
Welcome New Members
- shellijean, November 25, 2009 04:13 PM
- ricky_jain8, November 25, 2009 04:12 PM
- nicholasxavier6..., November 25, 2009 04:04 PM
- aaronpenny, November 25, 2009 03:57 PM
- mspurpl3kisses, November 25, 2009 03:56 PM
Mahalo Dollars are the currency of Mahalo Answers.
Each Mahalo Dollar costs $1.
Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More