LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-17-2003, 12:53 PM   #1
mickey717
LQ Newbie
 
Registered: Oct 2003
Posts: 3

Rep: Reputation: 0
Complicated Text -> Numbers


Hi. I don't know very much about Linux. Would it be possible to write script that converts certain text samples to pure numbers. How would I start doing this?
 
Old 10-17-2003, 12:59 PM   #2
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
that's kind of vague....can you give more details?

However, bash-scripting might do what you need it to do, or perl or python...(google any of these terms and you'll get plenty of info)

As for what you need it for, you have 2 choices really, learn one of the above and make a script (or program) for yourself or you can see if someone can do it for you if you ask nicely

(personally I'd recommend learning...its always good to stretch your abilities and plus you can make something that exactly fits your needs rather than relying on someone else to do it for you...but that just me)

Last edited by tcaptain; 10-17-2003 at 01:00 PM.
 
Old 10-17-2003, 01:17 PM   #3
mickey717
LQ Newbie
 
Registered: Oct 2003
Posts: 3

Original Poster
Rep: Reputation: 0
It's vague because I don't know anything! I don't even know where to begin. Yikes! What I need to do is if I have a text file that says

monday tree 4.5
wednesday tree 4.8 cloud 6

it can be converted into a matrix
mon wed
tree 4.5 4.8
cloud 6
 
Old 10-17-2003, 01:22 PM   #4
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
That's all I meant

Its ok if you don't know anything yet We all had to start sometime...I meant you were vague in what you wanted to do.

I mean "write script that converts certain text samples to pure numbers" doesn't say much.

I still say maybe a bash-script can do what you need, shouldn't be too hard to learn.

Hang in there

Try this link:

http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
 
Old 10-17-2003, 01:36 PM   #5
mickey717
LQ Newbie
 
Registered: Oct 2003
Posts: 3

Original Poster
Rep: Reputation: 0
Hmmm... looks interesting. Maybe I can figure something out with that. I actually know C++ (time wrap i know, i used borland too!); is there some way I can use C++? or will it be harder for me or the computer if i have 900 pages of text to convert.
 
Old 10-17-2003, 01:41 PM   #6
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
Heck, if you know C++, do it in C++! That would be a good way to get you started...

You don't mention which linux distro you have, but it is very likely that you have a C++ compiler installed (most have it installed by default).

C++ is simply more fun on linux...and heck, I learned C++ back on Borland and DOS so don't feel too bad...

Go to www.tldp.org and browse the Howtos and there should be one about C++ in there..
 
  


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
Printing numbers from a text file dynamically mrobertson Programming 1 06-28-2005 08:19 AM
Adding numbers, break on non-numbers... Cruger Programming 1 03-22-2004 09:18 AM
C help needed - reading from a complicated text file Keffin Programming 4 01-26-2004 09:32 PM
Searching a text file - complicated cyph3r7 Linux - General 2 12-16-2003 10:45 AM
HELP!!!! not too complicated stuff Gnute Slackware 13 05-16-2003 11:49 PM


All times are GMT -5. The time now is 07:49 AM.

Main Menu
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