<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Use awk/sed in vi</title>
	<atom:link href="http://askdba.org/weblog/2009/07/use-awksed-in-vi/feed/" rel="self" type="application/rss+xml" />
	<link>http://askdba.org/weblog/2009/07/use-awksed-in-vi/</link>
	<description>Writing About Our Experiences With Oracle Databases</description>
	<lastBuildDate>Fri, 05 Mar 2010 10:24:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Amit</title>
		<link>http://askdba.org/weblog/2009/07/use-awksed-in-vi/comment-page-1/#comment-3783</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Tue, 07 Jul 2009 11:48:07 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=497#comment-3783</guid>
		<description>Command :%j! is very useful as it can be used to format the output given by V$SQLTEXT 

&lt;pre&gt;
 select sql_text from V$SQLTEXT where sql_id=&#039;avv9twxrav4gk&#039; order by piece

SQL_TEXT
----------------------------------------------------------------
select decode(bitand(a.flags, 16384), 0, a.next_run_date,
         a.last_enabled_time),         a.obj#, decode(bitand(a.f
lags, 16384), 0, 0, 1)  from sys.scheduler$_job a  where bitand(
a.job_status, 3) = 1    and ((bitand(a.flags, 134217728 + 268435
456) = 0) or         (bitand(a.job_status, 1024)  0))    and b
itand(a.flags, 4096) = 0    and (a.class_oid is null      or (a.
class_oid is not null      and a.class_oid in (select b.obj# fro
m sys.scheduler$_class b                          where b.affini
ty is null)))    and decode(bitand(a.flags, 16384), 0, a.next_ru
n_date,               a.last_enabled_time) =  (select min(decode
(bitand(c.flags, 16384), 0, c.next_run_date,             c.last_
enabled_time))   from sys.scheduler$_job c   where bitand(c.job_
status, 3) = 1     and ((bitand(c.flags, 134217728 + 268435456)
= 0) or          (bitand(c.job_status, 1024)  0))     and bita
nd(c.flags, 4096) = 0     and (c.class_oid is null       or (c.c
lass_oid is not null       and c.class_oid in (select d.obj# fro
m sys.scheduler$_class d                           where d.affin
ity is null))))
&lt;/pre&gt;


When you use :%j! it will join line and remove space.

&lt;pre&gt;
select decode(bitand(a.flags, 16384), 0, a.next_run_date,         a.last_enabled_time),         a.obj#, decode(bitand(a.flags
, 16384), 0, 0, 1)  from sys.scheduler$_job a  where bitand(a.job_status, 3) = 1    and ((bitand(a.flags, 134217728 + 2684354
56) = 0) or         (bitand(a.job_status, 1024)  0))    and bitand(a.flags, 4096) = 0    and (a.class_oid is null      or (
a.class_oid is not null      and a.class_oid in (select b.obj# from sys.scheduler$_class b                          where b.a
ffinity is null)))    and decode(bitand(a.flags, 16384), 0, a.next_run_date,               a.last_enabled_time) =  (select mi
n(decode(bitand(c.flags, 16384), 0, c.next_run_date,             c.last_enabled_time))   from sys.scheduler$_job c   where bi
tand(c.job_status, 3) = 1     and ((bitand(c.flags, 134217728 + 268435456)= 0) or          (bitand(c.job_status, 1024)  0))
     and bitand(c.flags, 4096) = 0     and (c.class_oid is null       or (c.class_oid is not null       and c.class_oid in (s
elect d.obj# from sys.scheduler$_class d                           where d.affinity is null))))

&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Command :%j! is very useful as it can be used to format the output given by V$SQLTEXT </p>
<pre>
 select sql_text from V$SQLTEXT where sql_id='avv9twxrav4gk' order by piece

SQL_TEXT
----------------------------------------------------------------
select decode(bitand(a.flags, 16384), 0, a.next_run_date,
         a.last_enabled_time),         a.obj#, decode(bitand(a.f
lags, 16384), 0, 0, 1)  from sys.scheduler$_job a  where bitand(
a.job_status, 3) = 1    and ((bitand(a.flags, 134217728 + 268435
456) = 0) or         (bitand(a.job_status, 1024)  0))    and b
itand(a.flags, 4096) = 0    and (a.class_oid is null      or (a.
class_oid is not null      and a.class_oid in (select b.obj# fro
m sys.scheduler$_class b                          where b.affini
ty is null)))    and decode(bitand(a.flags, 16384), 0, a.next_ru
n_date,               a.last_enabled_time) =  (select min(decode
(bitand(c.flags, 16384), 0, c.next_run_date,             c.last_
enabled_time))   from sys.scheduler$_job c   where bitand(c.job_
status, 3) = 1     and ((bitand(c.flags, 134217728 + 268435456)
= 0) or          (bitand(c.job_status, 1024)  0))     and bita
nd(c.flags, 4096) = 0     and (c.class_oid is null       or (c.c
lass_oid is not null       and c.class_oid in (select d.obj# fro
m sys.scheduler$_class d                           where d.affin
ity is null))))
</pre>
<p>When you use :%j! it will join line and remove space.</p>
<pre>
select decode(bitand(a.flags, 16384), 0, a.next_run_date,         a.last_enabled_time),         a.obj#, decode(bitand(a.flags
, 16384), 0, 0, 1)  from sys.scheduler$_job a  where bitand(a.job_status, 3) = 1    and ((bitand(a.flags, 134217728 + 2684354
56) = 0) or         (bitand(a.job_status, 1024)  0))    and bitand(a.flags, 4096) = 0    and (a.class_oid is null      or (
a.class_oid is not null      and a.class_oid in (select b.obj# from sys.scheduler$_class b                          where b.a
ffinity is null)))    and decode(bitand(a.flags, 16384), 0, a.next_run_date,               a.last_enabled_time) =  (select mi
n(decode(bitand(c.flags, 16384), 0, c.next_run_date,             c.last_enabled_time))   from sys.scheduler$_job c   where bi
tand(c.job_status, 3) = 1     and ((bitand(c.flags, 134217728 + 268435456)= 0) or          (bitand(c.job_status, 1024)  0))
     and bitand(c.flags, 4096) = 0     and (c.class_oid is null       or (c.class_oid is not null       and c.class_oid in (s
elect d.obj# from sys.scheduler$_class d                           where d.affinity is null))))
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit</title>
		<link>http://askdba.org/weblog/2009/07/use-awksed-in-vi/comment-page-1/#comment-3699</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Thu, 02 Jul 2009 18:21:44 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=497#comment-3699</guid>
		<description>Hi Chris,

Thanks ..It is very cool..I have not seen few of commands like %j!..I would say i really needed it.. 

Cheers
Amit</description>
		<content:encoded><![CDATA[<p>Hi Chris,</p>
<p>Thanks ..It is very cool..I have not seen few of commands like %j!..I would say i really needed it.. </p>
<p>Cheers<br />
Amit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Neumueller</title>
		<link>http://askdba.org/weblog/2009/07/use-awksed-in-vi/comment-page-1/#comment-3698</link>
		<dc:creator>Chris Neumueller</dc:creator>
		<pubDate>Thu, 02 Jul 2009 17:52:28 +0000</pubDate>
		<guid isPermaLink="false">http://askdba.org/weblog/?p=497#comment-3698</guid>
		<description>Hi!

It&#039;s a very useful feature to pipe contents of a vi buffer through some unix command. However, vi has powerful text editing commands that nearly equal sed. The command

:%s/.*/&#039;&amp;&#039;/ &#124; 1,$-1s/$/,/ &#124; %j! &#124; 1s/.*/(&amp;)/

does about the same as our quotes script. You can register it as an ex command with

:command Quotes %s/.*/&#039;&amp;&#039;/ &#124; 1,$-1s/$/,/ &#124; %j! &#124; 1s/.*/(&amp;)/

and execute it with

:Quotes

though this probably only makes sense if you store it in your local .vimrc.</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>It&#8217;s a very useful feature to pipe contents of a vi buffer through some unix command. However, vi has powerful text editing commands that nearly equal sed. The command</p>
<p>:%s/.*/&#8217;&amp;&#8217;/ | 1,$-1s/$/,/ | %j! | 1s/.*/(&amp;)/</p>
<p>does about the same as our quotes script. You can register it as an ex command with</p>
<p>:command Quotes %s/.*/&#8217;&amp;&#8217;/ | 1,$-1s/$/,/ | %j! | 1s/.*/(&amp;)/</p>
<p>and execute it with</p>
<p>:Quotes</p>
<p>though this probably only makes sense if you store it in your local .vimrc.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
