LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-27-2005, 01:05 AM   #1
gigsz
LQ Newbie
 
Registered: Dec 2005
Posts: 18

Rep: Reputation: 0
on scripting


i'm not sure under what forum name shall i place this so forgive me if this one's out of place... anyway i was wondering if it possible in scripting to read a line from a file and then tokenize the string into several variables...

example:

i have a file which contains a string "run this string"
i would like to assigned each word into a different variable.. say first="run" second="this" and third="string"..


thanks..
 
Old 12-27-2005, 01:11 AM   #2
kvnband
Member
 
Registered: Jan 2004
Distribution: Suse 10.2
Posts: 107

Rep: Reputation: 15
I know that in PHP, you can use the explode() function, and I'm sure there is something similar (perhaps even named the same) for whatever scripting language is used on Linux (what language is it, BTW?)
Kevin
 
Old 12-27-2005, 01:35 AM   #3
gigsz
LQ Newbie
 
Registered: Dec 2005
Posts: 18

Original Poster
Rep: Reputation: 0
linux scripting =)
 
Old 12-27-2005, 01:50 AM   #4
kvnband
Member
 
Registered: Jan 2004
Distribution: Suse 10.2
Posts: 107

Rep: Reputation: 15
Quote:
Originally Posted by gigsz
linux scripting =)
Well, naturally, linux scripting. I was wondering in what language you were doing the scripting. PHP is a scripting language that linux can run just fine. As is C (I believe) and Perl. Whatever it is, you should look for something similar to php's explode function (I script PHP for a living..whole reason I got into Linux).

http://us3.php.net/explode

Kevin
 
Old 12-27-2005, 02:14 AM   #5
gigsz
LQ Newbie
 
Registered: Dec 2005
Posts: 18

Original Poster
Rep: Reputation: 0
not really sure about the language.. linux shell scripting...
 
Old 12-27-2005, 03:24 AM   #6
merchtemeagle
Member
 
Registered: Oct 2004
Location: Belgium
Distribution: Slackware 13.37
Posts: 512

Rep: Reputation: 31
Take a look at awk.
 
  


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
Scripting Help Please Jazinator Linux - Newbie 7 10-17-2004 07:35 PM
Need Help on Scripting wongedan Linux - Newbie 2 08-23-2004 09:11 PM
Scripting help JediMasterTux Linux - Newbie 2 07-13-2004 02:29 AM
scripting anjiie Linux - Newbie 1 02-16-2004 09:17 AM
Scripting Askari Programming 1 12-09-2003 10:25 AM


All times are GMT -5. The time now is 05:38 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration