×
UNIX.COM Login
Username:
Password:  
Show Password






👤


Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Columns into rows

👤 Login to reply
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-17-2010
Ramya_1104 Ramya_1104 is offline
Registered User
 
Join Date: May 2010
Last Activity: 18 May 2010, 9:42 AM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Columns into rows

Hi,

Let me know how to achieve the below requirment

Input:
========
Code:
     BEGIN DSSUBRECORD
         Name "DOC_NO_2"
         SqlType "-5"
         Precision "0"
         Scale "0"
         Nullable "0"
      END DSSUBRECORD
      BEGIN DSSUBRECORD
         Name "FROM_LOC"
         SqlType "-5"
         Precision "0"
         Scale "0"
         Nullable "0"
      END DSSUBRECORD

Output
=====
Code:
Name "DOC_NO_2" SqlType "-5" Precision "0" Scale "0 Nullable "0"
Name "FROM_LOC" SqlType "-5" Precision "0" Scale "0" Nullable "0"


Regards,
Ram

Last edited by Franklin52; 05-17-2010 at 04:01 AM.. Reason: Please use code tags!
Sponsored Links
    #2  
Old 05-17-2010
Franklin52's Unix or Linux Image
Franklin52 Franklin52 is offline
Registered User
 
Join Date: Feb 2007
Last Activity: 5 June 2018, 9:29 AM EDT
Location: The Netherlands
Posts: 7,747
Thanks: 139
Thanked 558 Times in 520 Posts
Try this:
Code:
awk '
{$1=$1} 
/Name/{s=$0; next}
/END/{print s;s=""}
{s=s FS $0}' file

Sponsored Links
👤 Login to reply

« Previous Thread | Next Thread »
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
Print rows into columns vikash.rastogi UNIX for Advanced & Expert Users 7 04-16-2010 08:20 AM
convert columns into rows Nishithinfy Shell Programming and Scripting 1 07-06-2009 11:16 AM
# of rows and columns kylle345 Shell Programming and Scripting 3 07-02-2009 08:15 PM
convert rows into columns loperam Shell Programming and Scripting 2 12-01-2008 02:57 AM
Columns to rows mgirinath Shell Programming and Scripting 16 11-29-2007 06:03 PM



All times are GMT -4. The time now is 09:03 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.