The UNIX and Linux Forums  

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
Bourne Shell script - log for users loggin on and off noodlesoup Shell Programming and Scripting 14 09-08-2006 07:30 PM
Bourne: How to invoke an alias from within a shell script techshots Shell Programming and Scripting 2 06-03-2006 09:38 PM
cd from a Bourne Shell Script - Please Help fawqati Shell Programming and Scripting 10 05-25-2006 12:26 AM
bourne shell script psrinivas Shell Programming and Scripting 2 12-06-2001 11:38 AM
Bourne shell script need help please ? dezithug UNIX for Advanced & Expert Users 7 10-24-2001 10:59 AM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-10-2003
Registered User
 

Join Date: Dec 2003
Posts: 1
Bourne Shell Script

Hello,

I'm throwing this out there as a novice to the Unix world...I've
been working on a project that requires me to ouput (using the echo command) a list of names in a single column format, but the problem is the input is in row format followed by a blank space...If anyone could give me a little guidance, I would appreciate it...Thanks a bunch...

input file = m,stevens k,williams t,bone b,james l,carlton

desired output =

m,stevens
k,williams
t,bone
b,james
l,carlton
Forum Sponsor
  #2 (permalink)  
Old 12-10-2003
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,226
Translate spaces to newlines
Code:
tr ' ' '\n' < file1 > file2
  #3 (permalink)  
Old 12-10-2003
oombera's Avatar
Have a day :|
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
If that list of names is stored in a variable, say nameList, you could use a simple loop:
Code:
for i in $nameList; do
 echo $i
done
If it's in a file, try:
Code:
while read LINE; do
 for i in $LINE; do
  echo $i
 done
done < yourFile
---------
or there's Ygor's simplified suggestion
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0