<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: awk printing ' character in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849618#M395052</link>
    <description>have you tried:&lt;BR /&gt;print "\'" $1 "\'";&lt;BR /&gt;or&lt;BR /&gt;printf("'%s'\n",$1);</description>
    <pubDate>Wed, 06 Aug 2003 11:40:02 GMT</pubDate>
    <dc:creator>curt larson_1</dc:creator>
    <dc:date>2003-08-06T11:40:02Z</dc:date>
    <item>
      <title>awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849610#M395044</link>
      <description>How do I print ' as part of an awk command, I can't seem to find the right way to do it.&lt;BR /&gt;&lt;BR /&gt;ls | awk '{print "'" $1 "'"}' just doesn't work.&lt;BR /&gt;&lt;BR /&gt;Thanks very much in anticipation of some stunning insights.</description>
      <pubDate>Wed, 06 Aug 2003 11:27:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849610#M395044</guid>
      <dc:creator>Gavin Clarke</dc:creator>
      <dc:date>2003-08-06T11:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849611#M395045</link>
      <description>Hi try&lt;BR /&gt;&lt;BR /&gt;awk '{print $x}'&lt;BR /&gt;&lt;BR /&gt;where x is the field number of your command</description>
      <pubDate>Wed, 06 Aug 2003 11:30:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849611#M395045</guid>
      <dc:creator>Walter Goncalves</dc:creator>
      <dc:date>2003-08-06T11:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849612#M395046</link>
      <description>awk '{ print $1 }'&lt;BR /&gt;&lt;BR /&gt;should work.  Cut and paste it to make sure you get the spacing right.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Aug 2003 11:32:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849612#M395046</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-08-06T11:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849613#M395047</link>
      <description>Hi,&lt;BR /&gt;the only way I can think of:&lt;BR /&gt;# echo hello | awk -v flip="\'" '{print flip $1 }'&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Aug 2003 11:33:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849613#M395047</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-08-06T11:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849614#M395048</link>
      <description>Sorry that's not going to work.  I need to print the character ' round either side of the filename ($1).&lt;BR /&gt;&lt;BR /&gt;Thanks for a quick reply though.</description>
      <pubDate>Wed, 06 Aug 2003 11:33:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849614#M395048</guid>
      <dc:creator>Gavin Clarke</dc:creator>
      <dc:date>2003-08-06T11:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849615#M395049</link>
      <description>That flip line seems to do the trick.&lt;BR /&gt;&lt;BR /&gt;Hmmm got out of sequence a bit there.</description>
      <pubDate>Wed, 06 Aug 2003 11:36:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849615#M395049</guid>
      <dc:creator>Gavin Clarke</dc:creator>
      <dc:date>2003-08-06T11:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849616#M395050</link>
      <description>Gavin,&lt;BR /&gt;&lt;BR /&gt;Sorry - I missed that you're trying to print the apostrophe.  Working . . . &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Aug 2003 11:36:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849616#M395050</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-08-06T11:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849617#M395051</link>
      <description>sorry,&lt;BR /&gt;should of course have been:&lt;BR /&gt;# ls | awk -v flip="\'" '{print flip $1 flip }'&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Wed, 06 Aug 2003 11:37:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849617#M395051</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-08-06T11:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849618#M395052</link>
      <description>have you tried:&lt;BR /&gt;print "\'" $1 "\'";&lt;BR /&gt;or&lt;BR /&gt;printf("'%s'\n",$1);</description>
      <pubDate>Wed, 06 Aug 2003 11:40:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849618#M395052</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-08-06T11:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849619#M395053</link>
      <description>Hi Gavin:&lt;BR /&gt;&lt;BR /&gt;# ls -l /tmp/me|awk '{print "'\''" $NF "'\''"}'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Aug 2003 11:42:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849619#M395053</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-08-06T11:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849620#M395054</link>
      <description>I did try using printf, I still had problems.&lt;BR /&gt;&lt;BR /&gt;If flip doesn't work then I'll give it another go.</description>
      <pubDate>Wed, 06 Aug 2003 11:43:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849620#M395054</guid>
      <dc:creator>Gavin Clarke</dc:creator>
      <dc:date>2003-08-06T11:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849621#M395055</link>
      <description>I had same issue a while ago&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;QUOT="'"&lt;BR /&gt;&lt;BR /&gt;echo " " | awk -v quot=$QUOT '&lt;BR /&gt;{ print quot,quot,"abcd",quot,quot;}'&lt;BR /&gt;&lt;BR /&gt;just an example.&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jean-luc</description>
      <pubDate>Wed, 06 Aug 2003 12:20:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849621#M395055</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2003-08-06T12:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849622#M395056</link>
      <description>Whoa, thanks for all the responses.  After some fiddling I got what I wanted, which was a little more complicated than the example I gave (but not alot).&lt;BR /&gt;&lt;BR /&gt;I adopted the "'\''" approach after I'd cut and paste it into notepad to see what was actually going on, seemed to fit well with what I was doing.</description>
      <pubDate>Wed, 06 Aug 2003 13:46:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849622#M395056</guid>
      <dc:creator>Gavin Clarke</dc:creator>
      <dc:date>2003-08-06T13:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849623#M395057</link>
      <description>Hi (again) Gavin:&lt;BR /&gt;&lt;BR /&gt;For clarity later, the post of mine you used:&lt;BR /&gt;&lt;BR /&gt;# ls -l /tmp/me|awk '{print "'\''" $NF "'\''"}'&lt;BR /&gt;&lt;BR /&gt;is garbled badly when it is displayed here.  For reference, the character sequence is:&lt;BR /&gt;&lt;BR /&gt;...print &lt;DOUBLEQUOTE&gt; &lt;SINGLEQUOTE&gt; &lt;BACKSLASH&gt; &lt;SINGLEQUOTE&gt; &lt;SINGLEQUOTE&gt; &lt;DOUBLEQUOTE&gt; $NF &lt;DOUBLEQOUTE&gt; &lt;SINGLEQUOTE&gt; &lt;BACKSLASH&gt; singlequote&amp;gt; &lt;SINGLEQUOTE&gt; &lt;DOUBLEQUOTE&gt; ) &lt;SINGLEQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/SINGLEQUOTE&gt;&lt;/DOUBLEQUOTE&gt;&lt;/SINGLEQUOTE&gt;&lt;/BACKSLASH&gt;&lt;/SINGLEQUOTE&gt;&lt;/DOUBLEQOUTE&gt;&lt;/DOUBLEQUOTE&gt;&lt;/SINGLEQUOTE&gt;&lt;/SINGLEQUOTE&gt;&lt;/BACKSLASH&gt;&lt;/SINGLEQUOTE&gt;&lt;/DOUBLEQUOTE&gt;</description>
      <pubDate>Wed, 06 Aug 2003 14:00:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849623#M395057</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-08-06T14:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849624#M395058</link>
      <description>do it this way&lt;BR /&gt;&lt;BR /&gt;ls | awk '{print $1}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;For clearer explanation go through the AWK PROGRAMMING MODEL&lt;BR /&gt;which explains how the awk works &lt;BR /&gt;&lt;A href="http://linux-forum-karthik.blogspot.com/2011/05/awk-programming-model.html" target="_blank"&gt;http://linux-forum-karthik.blogspot.com/2011/05/awk-programming-model.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;and go through the awk variables usuage &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://linux-forum-karthik.blogspot.com/2011/05/awk-variables.html" target="_blank"&gt;http://linux-forum-karthik.blogspot.com/2011/05/awk-variables.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Above links will be useful in learning the same.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 05 Jun 2011 18:09:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849624#M395058</guid>
      <dc:creator>karthik3152</dc:creator>
      <dc:date>2011-06-05T18:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849625#M395059</link>
      <description>You don't.  A single quote is used to quote the whole awk script.  If you want to use a single quote, you need to use an awk program file then you don't need to quote:&lt;BR /&gt;ls | evil_quoting_script.awk&lt;BR /&gt;In the script:&lt;BR /&gt;#!/usr/bin/awk -f&lt;BR /&gt;{print "'" $1 "'"}&lt;BR /&gt;&lt;BR /&gt;Or you can do it the direct (right) way with escapes:&lt;BR /&gt;ls | awk '{print "\x27" $1 "\x27"}'&lt;BR /&gt;&lt;BR /&gt;&amp;gt;karthik3152: do it this way&lt;BR /&gt;&lt;BR /&gt;The OP has said several times that's not what he wants.</description>
      <pubDate>Sun, 05 Jun 2011 18:57:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849625#M395059</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-06-05T18:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849626#M395060</link>
      <description>I should also point out that I asked this question approximately eight years ago!&lt;BR /&gt;&lt;BR /&gt;I suppose I'd better close the thread.</description>
      <pubDate>Thu, 09 Jun 2011 14:56:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849626#M395060</guid>
      <dc:creator>Gavin Clarke</dc:creator>
      <dc:date>2011-06-09T14:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: awk printing ' character</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849627#M395061</link>
      <description>There are some right answers in here to what I found to be a tricky awk problem at the time.</description>
      <pubDate>Thu, 09 Jun 2011 14:58:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-printing-character/m-p/4849627#M395061</guid>
      <dc:creator>Gavin Clarke</dc:creator>
      <dc:date>2011-06-09T14:58:10Z</dc:date>
    </item>
  </channel>
</rss>

