LinuxQuestions.org
Register a domain and help support LQ
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-20-2012, 05:36 AM   #1
swapnika.a60
LQ Newbie
 
Registered: Dec 2012
Posts: 1

Rep: Reputation: Disabled
read a line from file , parse it and store in variables,print them using shell script


read a line from file , parse it and store in variables,print them using shell script

My file looks like
id colorname colorcode
1 Green #75923c
2 Red #D18381
3 Blue #A38DBC
4 Light Blue #799ECC
5 Orange #e46d0a
6 Gray #a5a5a5
~
I'm new to linux please help me in solving this.
Thanks for help
 
Old 12-20-2012, 08:10 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950
Please use ***[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.


What have you tried so far? We're not going to do your homework for you, but we will help you out when you have specific problems.

I suggest you start by reading through a good scripting reference like the BashGuide here:
http://mywiki.wooledge.org/BashGuide

Then check out the related Bash Pitfalls and Bash FAQ lists. FAQ #1 in particular should be very helpful for your current requirements.
 
Old 12-20-2012, 08:20 AM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
See also
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

As above, have a go and come back if you get stuck
 
  


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
tcl: read a line and parse into variables Jykke Programming 1 06-23-2012 07:18 AM
How to read in line-by-line from a file and store them in several variables ncjlee Programming 1 09-28-2008 07:20 PM
Help w/ script to read file and parse variables cslink23 Linux - General 18 11-26-2006 03:22 AM
How to read ans parse MS word file using a Linux Shell script. Alek Linux - General 2 11-10-2003 03:07 PM


All times are GMT -5. The time now is 05:26 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