<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

<channel>
<title>Topic &#x27;grep (awk, sed) help&#x27; in forum &#x27;All Things Unix&#x27; - dslreports.com</title>
<link>http://www.dslreports.com/forum/grep-awk-sed-help-27625994</link>
<description></description>
<language>en</language>
<pubDate>Fri, 24 May 2013 14:01:31 EDT</pubDate>
<lastBuildDate>Fri, 24 May 2013 14:01:31 EDT</lastBuildDate>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27631219</link>
<description><![CDATA[pablo posted : Funny you mention that  Black Box <A HREF="/useremail/u/740280"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> as offline, I mentioned the same  Brano <A HREF="/useremail/u/649954"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> ... :)<br><br>Incidentally, the issue why my sed script wasn't working was resolved.  The Regular Expression  Brano <A HREF="/useremail/u/649954"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> used didn't cover the input file.  :)<br><br>Cheers,<br>-pablo<br><small>--<br>openSUSE 12.2/KDE 4.x<br>ISP:  TekSavvy Bonded DSL; backhauled  via a 6KM wireless link<br>Assorted goodies:  &raquo;<A HREF="http://pablo.blog.blueoakdb.com" >pablo.blog.blueoakdb.com</A></small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27631219</guid>
<pubDate>Wed, 17 Oct 2012 09:22:07 EDT</pubDate>
</item>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27631162</link>
<description><![CDATA[Black Box posted : For the sake of completeness, I'll mention that the whole script can be put in a file (let's say <code>myfilter</code>) that if made executable can be executed directly. I takes the same parameters as <code>awk</code>, so if invoked <code>myfilter input.txt</code> it will filter the <code>input.txt</code> file and put the filtered output on the standard output. Pipe or redirect as you wish ;).<br><br><small>--<br>Keep It Safe, Stupid!<br>Yes, I <b><A HREF="/forum/canchat/">CanChat</a></b>. Can You?</small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27631162</guid>
<pubDate>Wed, 17 Oct 2012 09:07:32 EDT</pubDate>
</item>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27629929</link>
<description><![CDATA[pablo posted : Did you try invoke sed as I mentioned in my last post?  "sed -n -f the-script-file input-file-1 input-file-2 ... etc"<br><br>Thx!<br>-pablo]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27629929</guid>
<pubDate>Tue, 16 Oct 2012 21:50:44 EDT</pubDate>
</item>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27629852</link>
<description><![CDATA[Brano posted : Ok guys, thank you for all 3 examples.<br><br>The awk posted by  Black Box <A HREF="/useremail/u/740280"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> and the sed posted by  Uraki <A HREF="/useremail/u/830090"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> are doing what I need.<br> pablo <A HREF="/useremail/u/830709"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> your is not producing desired output (or I'm doing something wrong).<br><br>In any case, mission accomplished, thank you all for help.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27629852</guid>
<pubDate>Tue, 16 Oct 2012 21:32:50 EDT</pubDate>
</item>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27629741</link>
<description><![CDATA[Uraki posted : &raquo;<A HREF="http://www.theunixschool.com/2012/06/sed-25-examples-to-delete-line-or.html" >www.theunixschool.com/2012/06/se&middot;&middot;&middot;-or.html</A><br><br>Check out #23 in the list, exactly what you want, I think.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27629741</guid>
<pubDate>Tue, 16 Oct 2012 21:03:06 EDT</pubDate>
</item>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27627981</link>
<description><![CDATA[pablo posted : Howdy,<br><br>You're welcome ... as a gentle reminder, invoke the sed script using the `-n' parameter:  sed -n -f the-script-file file-1 ... file-N<br><br>:)<br><br>Cheers!<br>-pablo<br><small>--<br>openSUSE 12.2/KDE 4.x<br>ISP:  TekSavvy Bonded DSL; backhauled  via a 6KM wireless link<br>Assorted goodies:  &raquo;<A HREF="http://pablo.blog.blueoakdb.com" >pablo.blog.blueoakdb.com</A></small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27627981</guid>
<pubDate>Tue, 16 Oct 2012 13:16:56 EDT</pubDate>
</item>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27627836</link>
<description><![CDATA[Brano posted : Thank you both. I was able to do what I need using multiple line script, but was hoping for simpler potentially one line solution. ... Pablo, your's the one I guess :)<br><br>FYI: My pattern is never on 1st line so the generic sed should just do perfectly, I'll test it later.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27627836</guid>
<pubDate>Tue, 16 Oct 2012 12:45:10 EDT</pubDate>
</item>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27627800</link>
<description><![CDATA[pablo posted : Hi Brano,<br><br>As always, Linux/Unix has many filters to solve the same issue.  :)  <br><br>Here's a solution using sed.<br><br>Suppose we have the following text file ....<br><br><pre class="brush: text">BOO&#012;a&#012;b&#012;BOO&#012;x&#012;y&#012;z&#012;BOO&#012;black&#012;blue&#012;green&#012;BOO&#012; &#012;</pre><!--end code block--><br>The following "sed" script would remove BOO and the preceding line:<br><br><small>sed code</small>:<div class="syntax"><pre><span class="codetext"><font color="#FFFFFF"><font color="#8080ff">#</font><br><font color="#8080ff"># Handle the special case when our token is on line 1.</font><br><font color="#8080ff">#</font><br><font color="#ff40ff">/</font><font color="#ff40ff">^</font><font color="#ff40ff">BOO</font><font color="#ff40ff">$</font><font color="#ff40ff">/</font><font color="#00ffff">d</font><br> <br><font color="#8080ff">#</font><br><font color="#8080ff"># This is the generic case for line 2 .. N</font><br><font color="#8080ff">#</font><br><font color="#ff40ff">/</font><font color="#ff40ff">^.*$</font><font color="#ff40ff">/</font><font color="#ff40ff">{</font><br>   <font color="#00ffff">N</font><br><font color="#ff40ff">   /</font><font color="#ff40ff">.*\n</font><font color="#ff40ff">BOO</font><font color="#ff40ff">$</font><font color="#ff40ff">/</font><font color="#00ffff">d</font><br>   <font color="#00ffff">P</font><br>   <font color="#00ffff">D</font><br><font color="#ff40ff">}</font><br></font> &#012;</pre><!--end code block--><br><small>--<br>openSUSE 12.1/KDE 4.x<br>ISP:  TekSavvy Bonded DSL; backhauled  via a 6KM wireless link<br>Assorted goodies:  &raquo;<A HREF="http://pablo.blog.blueoakdb.com" >pablo.blog.blueoakdb.com</A></small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27627800</guid>
<pubDate>Tue, 16 Oct 2012 12:36:17 EDT</pubDate>
</item>

<item>
<title>Re: grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/Re-grep-awk-sed-help-27626515</link>
<description><![CDATA[Black Box posted : This looks like a job for awk. Here is my first crack at it, I bet it can be improved:<br><br><small>awk code</small>:<div class="syntax"><pre><span class="codetext"><font color="#FFFFFF"><font color="#8080ff">#!/usr/bin/awk -f                                                             </font><br> <br><font color="#ff40ff">BEGIN</font> {<br>    prev = <font color="#ff6060">&quot;&quot;</font><br>    skip = <font color="#ff6060">&quot;YES&quot;</font><br>}<br> <br>{<br>    <font color="#ffff00">if</font> (<font color="#ff6060">/mypattern/</font>) {<br>        skip = <font color="#ff6060">&quot;YES&quot;</font><br>    } <font color="#ffff00">else</font> {<br>        <font color="#ffff00">if</font> (<font color="#ff6060">&quot;NO&quot;</font> == skip) {<br>            <font color="#ffff00">print</font> prev<br>        }<br> <br>        prev = <font color="#ff40ff">$0</font><br>        skip = <font color="#ff6060">&quot;NO&quot;</font><br>    }<br>}<br> <br><font color="#ff40ff">END</font> {<br>    <font color="#ffff00">if</font> (<font color="#ff6060">&quot;NO&quot;</font> == skip) {<br>        <font color="#ffff00">print</font> prev<br>    }<br>}<br></font></span></pre></div>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/Re-grep-awk-sed-help-27626515</guid>
<pubDate>Tue, 16 Oct 2012 00:41:30 EDT</pubDate>
</item>

<item>
<title>grep (awk, sed) help</title>
<link>http://www.dslreports.com/forum/grep-awk-sed-help-27625994</link>
<description><![CDATA[Brano posted : I have a text file with various text on separate lines. How can I match on pattern and then <u>not</u> display that line <u>and line immediately before the matched line</u>?<br><br>For the one line I can do <code> grep -v mypattern myfile</code> ... works for the one line.<br>I can match the previous line with <code> grep -B1 mypattern myfile</code> ... but how can I combine these two expressions?<br><br>If line is matching mypattern don't output the line and don't output the line just before the matched line.<br><br>I'd like to stay with shell tools i.e. grep, awk, sed (no perl, no python).<br><br>Thank you!!!<br>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/grep-awk-sed-help-27625994</guid>
<pubDate>Mon, 15 Oct 2012 20:50:34 EDT</pubDate>
</item>

</channel>
</rss>
