The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reading a binary file in text or ASCII format Nagendra High Level Programming 3 12-03-2008 06:11 PM
Reading a mailbox and sending new messages to a text file rsw626 Shell Programming and Scripting 1 04-17-2008 01:35 PM
Reading from Text file..... user__user3110 Shell Programming and Scripting 0 04-11-2008 05:18 AM
Reading text from a file LiquidChild Shell Programming and Scripting 12 05-30-2007 08:38 AM
reading text file jaan Shell Programming and Scripting 1 02-16-2004 08:43 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-12-2008
bilal05 bilal05 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 1
Help with reading text file

How can i have a while loop as follows

while read inputline
do
<task>
done < name_list

and also store the values (delimited) on each line to temp variables so as to print them on screen as follows

while read inputline
do
set name | cut -d "," -f1 name_list # #i know this is not correct
set age | cut -d "," -f1 name_list # #i know this is not correct

echo $name
echo $age

done < name_list

exit 0

thanks for being patient
  #2 (permalink)  
Old 04-12-2008
wempy's Avatar
wempy wempy is offline
Registered User
  
 

Join Date: Jun 2006
Location: Harpenden, UK
Posts: 208
you didn't say what your file layout actually is so assuming a file layed out thus:

Code:
name,age
colin,30
trevor,28
deidre,45
Code:
awk 'FS="," {print $1 "\t" $2}' name_list
will achieve what you want.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:45 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0