<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-us"><generator uri="https://gohugo.io/" version="0.101.0">Hugo</generator><title type="html">condition on A Scripter's Notes</title><subtitle type="html">Emacs, scripting and anything text oriented.</subtitle><link href="https://scripter.co/categories/condition/" rel="alternate" type="text/html" title="HTML"/><link href="https://scripter.co/categories/condition/index.xml" rel="alternate" type="application/rss+xml" title="RSS"/><link href="https://scripter.co/categories/condition/atom.xml" rel="self" type="application/atom+xml" title="Atom"/><link href="https://scripter.co/categories/condition/jf2feed.json" rel="alternate" type="application/jf2feed+json" title="jf2feed"/><updated>2026-04-22T08:24:57-04:00</updated><author><name>Kaushal Modi</name><email>kaushal.modi@gmail.com</email></author><id>https://scripter.co/categories/condition/</id><entry><title type="html">One liner if-else in awk</title><link href="https://scripter.co/one-liner-if-else-in-awk/?utm_source=atom_feed" rel="alternate" type="text/html"/><id>https://scripter.co/one-liner-if-else-in-awk/</id><published>2014-03-18T16:00:53-04:00</published><updated>2014-03-18T16:00:53-04:00</updated><content type="html"><![CDATA[<p>Tiny snippets showing if/else use in <code>awk</code> ..</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> abc:def <span class="p">|</span> awk -F: <span class="s1">&#39;{ if ( $2 ) {print $2} else {print} }&#39;</span>
</span></span></code></pre></div><p>Prints <code>def</code>.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> abc <span class="p">|</span> awk -F: <span class="s1">&#39;{ if ( $2 ) {print $2} else {print} }&#39;</span>
</span></span></code></pre></div><p>Prints <code>abc</code>.</p>]]></content><category scheme="https://scripter.co/categories/awk" term="awk" label="awk"/><category scheme="https://scripter.co/categories/condition" term="condition" label="condition"/><category scheme="https://scripter.co/categories/oneliner" term="oneliner" label="oneliner"/></entry></feed>