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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
make multiple line containing a pattern into single line VTAWKVT Shell Programming and Scripting 13 12-04-2008 06:40 PM
Can df output be forced to a single line for each file system? shew01 Shell Programming and Scripting 6 06-05-2008 11:25 AM
ls command output in single line arsheshadri AIX 7 04-28-2008 02:50 PM
Need output in different lines not in one single line csaha Shell Programming and Scripting 1 02-08-2006 08:28 AM
Making multi line output appear on one line djsal Shell Programming and Scripting 1 10-07-2004 06:21 PM

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

Join Date: Aug 2007
Location: DFW, Texas
Posts: 60
Multi-line output to single line

Hello,

How can I take the following output:

outputa
outputb
outputc



and turn it into single line ouput, with a single space between each field like below:

outputa outputb outputc
  #2 (permalink)  
Old 02-25-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
presume this is the output from a script. You can change your script to display in the same line instead of printing in the newline.
Eg :-

echo "outputa\c "
echo "outputb\c "
echo "outputc"

'\c' in the above echo will make sure next echo to print in the same line.
  #3 (permalink)  
Old 02-25-2008
ilan ilan is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 101
correct, but you may have to use -e option with echo to get the \c interpreted.

-ilan
  #4 (permalink)  
Old 02-25-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
am on solaris and using Bourne shell which doesn't require '-e' option
  #5 (permalink)  
Old 02-25-2008
ilan ilan is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 101
Mani, thanks again for correcting me; i am not much aware of Solaris.
  #6 (permalink)  
Old 02-25-2008
Tytalus's Avatar
Tytalus Tytalus is offline Forum Advisor  
echo {1..9}^2\;|bc
  
 

Join Date: Jun 2003
Location: Scotland
Posts: 431
have a look at the man page for tr.

What you probably want here is:

Code:
tr "\n" " " < infile
Closed Thread

Bookmarks

Tags
solaris

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 12:29 AM.


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