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
SED - adding a new line after pattern eagercyber Shell Programming and Scripting 6 07-06-2008 12:06 PM
Delete a block of text delimited by blank lines when pattern is found gleu Shell Programming and Scripting 17 12-16-2007 11:30 PM
adding a new line using sed command ivesia SUN Solaris 2 11-07-2005 09:41 PM
adding blank line in egrep antalexi UNIX for Dummies Questions & Answers 2 05-24-2004 01:40 PM
cant find command that returns blank line jeffersno1 UNIX for Dummies Questions & Answers 2 11-15-2001 04:14 PM

 
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 Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-01-2009
frozensmilz's Avatar
frozensmilz frozensmilz is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 28
Need help in sed command (adding a blank line btw each block generated by pattern)

Hello friends,

I have a C source code containing sql statements. I use the following sed command to print all the sql blocks in the source code....

sed -n "/exec sql/,/;/p" Sample.cpp

The above sed command will print the sql blocks based on the pattern "exec sql" & ";" (since most of them start with "exec" & ends in ";") & the output will look like this (with no ">>>>")

1>>>> exec sql select pqxQrn,
pqxPmeOldQcl
into :qrn, :qxt, :cuk, :cln, :pqxTdd,
:pmeOldQcl indicator :pmeOldQclInd
from pqx
1>>>>where pqxDno = :dno;
2>>>>exec sql select qcfQcl into :oldQcl from qcf
1>>>> where qcfCuk = :cuk;
2>>>> exec sql select cufCid
into :cid
from cuf
1>>>>where cufCuk = :cuk;
2>>>> exec sql select clrChief
into :chief
from clr
1>>>> where clrCln = :cln;
2>>>> exec sql select count(*) into :cnt from pqx
1>>>> where pqxQrn < :qrn;
2>>>> exec sql declare xqxPmeCur cursor for
select pqxQrn
from pqx
where pqxQxt = QXT_PME and
pqxCuk = :cuk and
pqxPmeDno = :dno and
1>>>> pqxTdd = :pqxTdd;
2>>>> exec sql open xqxPmeCur;

I would like to insert a space in between each sql blocks (between "1>>>>" & "2>>>>").....so that it is more readable. Kindly help....& thanks in advance.....
 

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 08:46 PM.


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