Script: Convert row in to column

Hi,

i need to convert

SG_ERP1
SG_ERP2
SG_ERP3

in to:

SG_ERP1 SG_ERP2 SG_ERP3

It's possibile?

Hi.

Yes, it is possible with the paste command.

one thing i like is use of cat and echo

-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$
awk -v ORS=" " '1' input.txt
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:

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?

please post the output of what you are trying to accomplish

SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01

SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01

Try..

$ uname
Linux
$ sed -n 'H;/^$/x;$x;s/\n/ /gp' inputfile 
 SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01 
 SG_LNX_JOKER_PRE01 SG_LNX_PENGUIN_PRE01 VP_Cattivi_pre01
$ 

You might try: tr
Example:

tr '\n' ';' < input > output

great it's work! thanks

---------- Post updated 07-12-12 at 10:33 AM ---------- Previous update was 06-12-12 at 01:45 PM ----------

at the end i have this other question. In my complex script the final output it's like that:

 
21A4|102428|60000970000292603621533032314134|SATA|SG_LNX_JOKER_SIT02|||||||||||||||SG_LNX_PENGUIN_SIT02|||||||||||||VP_Cattivi_sit02|||||||||||||||||||
21A8|102428|60000970000292603621533032314138|SATA|SG_LNX_JOKER_SIT02|||||||||||||||SG_LNX_PENGUIN_SIT02|||||||||||||VP_Cattivi_sit02|||||||||||||||||||
21AC|102428|60000970000292603621533032314143|SATA|SG_LNX_JOKER_SIT02|||||||||||||||SG_LNX_PENGUIN_SIT02|||||||||||||VP_Cattivi_sit02|||||||||||||||||||

i want it's be like that:

 
21A4|102428|60000970000292603621533032314134|SATA|SG_LNX_JOKER_SIT02|SG_LNX_PENGUIN_SIT02|VP_Cattivi_sit02|
21A8|102428|60000970000292603621533032314138|SATA|SG_LNX_JOKER_SIT02|SG_LNX_PENGUIN_SIT02|VP_Cattivi_sit02|
21AC|102428|60000970000292603621533032314143|SATA|SG_LNX_JOKER_SIT02|SG_LNX_PENGUIN_SIT02|VP_Cattivi_sit02|

It's possibile with TR?

If you want to extract specific columns, look at using cut.

If you just want to elimate the repeating "||" characters, use sed.

i want replace || with one |

Then use sed.

how exactly?

sed "s/||*/|/g"

Read the man page.

please try:

cat file |tr "\n" " "

thanks, with sed my script works!