Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


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

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-06-2012
Registered User
 
Join Date: Dec 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Script: Convert row in to column

Hi,

i need to convert


Code:
SG_ERP1
SG_ERP2
SG_ERP3

in to:


Code:
SG_ERP1 SG_ERP2 SG_ERP3

It's possibile?
Sponsored Links
    #2  
Old 12-06-2012
Scott's Avatar
Scott Scott is offline Forum Staff  
Administrator
 
Join Date: Jun 2009
Location: Zürich
Posts: 6,888
Thanks: 212
Thanked 749 Times in 654 Posts
Hi.

Yes, it is possible with the paste command.
Sponsored Links
    #3  
Old 12-06-2012
Registered User
 
Join Date: Jul 2009
Posts: 265
Thanks: 7
Thanked 2 Times in 2 Posts
one thing i like is use of cat and echo

Code:
-bash-3.2$ cat test
a
b
c
-bash-3.2$ echo `cat test`
a b c
-bash-3.2$ echo $(cat test)
a b c
-bash-3.2$

    #4  
Old 12-06-2012
itkamaraj's Avatar
^Kamaraj^
 
Join Date: Apr 2010
Posts: 3,025
Thanks: 33
Thanked 647 Times in 625 Posts

Code:
awk -v ORS=" " '1' input.txt

Sponsored Links
    #5  
Old 12-06-2012
Registered User
 
Join Date: Dec 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Code:
SG_LNX_JOKER_PRE01
SG_LNX_PENGUIN_PRE01
VP_Cattivi_pre01

SG_LNX_JOKER_PRE01
SG_LNX_PENGUIN_PRE01
VP_Cattivi_pre01


it's changed in one row:


Code:
SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01  SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01  SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01

How can i preserve the space from two groups?

Last edited by Scott; 12-06-2012 at 06:54 AM.. Reason: Code tags
Sponsored Links
    #6  
Old 12-06-2012
Registered User
 
Join Date: Jul 2009
Posts: 265
Thanks: 7
Thanked 2 Times in 2 Posts
please post the output of what you are trying to accomplish
Sponsored Links
    #7  
Old 12-06-2012
Registered User
 
Join Date: Dec 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Code:
SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01

SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01


Last edited by Scott; 12-06-2012 at 06:54 AM.. Reason: Code tags
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
convert row to column with respect of first column. asavaliya Shell Programming and Scripting 4 09-07-2012 04:34 PM
Convert column data to row data using shell script sktkpl UNIX for Advanced & Expert Users 4 06-06-2012 05:55 AM
Convert row to column gvj Shell Programming and Scripting 1 10-20-2011 10:59 AM
column to row convert - script - help G0Y Shell Programming and Scripting 10 11-14-2008 04:12 AM
convert column into row with some modifier cdfd123 UNIX for Dummies Questions & Answers 1 07-10-2008 03:23 AM



All times are GMT -4. The time now is 01:02 PM.