The UNIX and Linux Forums  


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
convert rows into columns loperam Shell Programming and Scripting 2 12-01-2008 03:57 AM
Converting Column to Rows in a Flat file srinikal Shell Programming and Scripting 5 10-10-2008 04:32 PM
awk - reformating rows into columns jmd2004 Shell Programming and Scripting 1 08-14-2008 12:56 AM
How to changes rows to columns in a file oracle123 Shell Programming and Scripting 4 07-31-2008 05:38 AM
Columns to rows mgirinath Shell Programming and Scripting 16 11-29-2007 07:03 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 Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 12-09-2008
patrykxes patrykxes is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 23
how to converting rows to columns, bash

I have in file these words:
[fraza:/]
@fraza1 = rw
@fraza2 = r
@fraza3 = r
@fraza4 = r

[fraza:/public/info]
@fraza5 = r
@fraza1 = r
@fraza6 = r
@fraza7 = r
@fraza2 = r
@fraza8 = r
@fraza9 = r
...

I would like so that:
[fraza:/],rw,@fraza1
[fraza:/],r,@fraza2
[fraza:/],r,@fraza3
[fraza:/],r,@fraza4
[fraza:/public/info],r,@fraza5
[fraza:/public/info],r,@fraza1
[fraza:/public/info],r,@fraza6
[fraza:/public/info],r,@fraza7
[fraza:/public/info],r,@fraza2
[fraza:/public/info],r,@fraza8
[fraza:/public/info],r,@fraza9
...

How to do this ?
Thx
  #2 (permalink)  
Old 12-09-2008
radoulov's Avatar
radoulov radoulov is online now Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,918
Use nawk or /usr/xpg4/bin/awk on Solaris:


Code:
awk -F' = ' '/^\[/ { _ = $0 }
NF > 1 { print _, $2, $1 }
' OFS=, infile

  #3 (permalink)  
Old 12-09-2008
patrykxes patrykxes is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 23
Thank you very much
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:18 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