Unix/Linux Go Back    


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

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-17-2010   -   Original Discussion by Ramya_1104
Ramya_1104's Unix or Linux Image
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 Unix and Linux 05-17-2010   -   Original Discussion by Ramya_1104
Franklin52's Unix or Linux Image
Franklin52 Franklin52 is offline
Registered User
 
Join Date: Feb 2007
Last Activity: 5 March 2018, 10:49 AM EST
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
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 06:05 PM.