<?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: Simple awk - printf question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707816#M903744</link>
    <description>part part ... i meant part not party.&lt;BR /&gt;still in the weekend mood. monday morning arrived too fast :-)&lt;BR /&gt;&lt;BR /&gt;[N/A] pls.</description>
    <pubDate>Mon, 22 Apr 2002 05:15:25 GMT</pubDate>
    <dc:creator>Deepak Extross</dc:creator>
    <dc:date>2002-04-22T05:15:25Z</dc:date>
    <item>
      <title>Simple awk - printf question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707813#M903741</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I am trying to process a file with uneven spaces (actually I found a pattern which is two or more spaces) to insert pipes as field delimiters and I am successful in doing so ... but I would like to keep the pipe for further processing in the shell script how do I do that ? I am not that familiar with printf ? Any help would be appreciated .. here is an example:&lt;BR /&gt;&lt;BR /&gt;prompt&amp;gt;cat $testfile&lt;BR /&gt;string1&amp;lt;2spaces&amp;gt;string2&amp;lt;10spaces&amp;gt;string3&amp;lt;6spaces&amp;gt;....&lt;BR /&gt;&lt;BR /&gt;prompt&amp;gt;grep "WF" ${testfile} | grep -i "online" | grep -v -i "gentrig" | sed 's/[ ][ ] */\|/g' | awk -F\| '{print $1,$6,$9,$10}' | while read SIEB_SRVR STATUS D&lt;BR /&gt;ATE TIME&lt;BR /&gt;&lt;BR /&gt;but unfortunately the second field ($6 in this case) is a string with spaces and dashes ... so it is a hindrance for further processing and hence I want to keep the PIPE even after splitting the fields ???&lt;BR /&gt;&lt;BR /&gt;Any ideas would be appreciated..&lt;BR /&gt;&lt;BR /&gt;I found a workaround but would like to keep it simple ...&lt;BR /&gt;&lt;BR /&gt;I can explain further if needed.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shabu</description>
      <pubDate>Mon, 22 Apr 2002 03:30:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707813#M903741</guid>
      <dc:creator>SHABU KHAN</dc:creator>
      <dc:date>2002-04-22T03:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk - printf question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707814#M903742</link>
      <description>Hi Shabu,&lt;BR /&gt;I'm not quite clear about your requirements..if you aren't considering spaces as party of the string, have you considered doing a &lt;BR /&gt;tr -s " " &lt;BR /&gt;on the string first to eliminate duplicate spaces?</description>
      <pubDate>Mon, 22 Apr 2002 04:58:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707814#M903742</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2002-04-22T04:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk - printf question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707815#M903743</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Never mind ... Deepak and All, &lt;BR /&gt;&lt;BR /&gt;I fixed it ...&lt;BR /&gt;&lt;BR /&gt;This is what I did:&lt;BR /&gt;-------------------&lt;BR /&gt;WKFS=`grep "WF" ${SMGR_LOG} | grep -i "online" | grep -v -i "gentrig"`&lt;BR /&gt;&lt;BR /&gt;WKFS_TRIM=`echo "${WKFS}" | sed -e 's/[ ][ ] */\|/g' -e 's/ [0-9][0-9]/\|&amp;amp;/g'`&lt;BR /&gt;&lt;BR /&gt;echo "${WKFS_TRIM}" | sed -e 's/\| /\|/g' -e 's/ /_/g' | awk -F\| '{print $1,$2,$6,$9,$10}' | while read SIEB_SRVR WKF STATUS DATE TIME&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;         WF_STATUS_SCRATCH=`echo "${WKF}" | sed -e 's/_/ /g'`&lt;BR /&gt;         WF_STATUS_ORIG=`grep "${WF_STATUS_SCRATCH}" ${SMGR_LOG} | grep "Running"`&lt;BR /&gt;&lt;BR /&gt;if [ -z ${WF_STATUS_SCRATCH}" ]; then&lt;BR /&gt; print messages ...&lt;BR /&gt; notify etc..&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;No need for any responses..&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shabu &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Apr 2002 05:12:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707815#M903743</guid>
      <dc:creator>SHABU KHAN</dc:creator>
      <dc:date>2002-04-22T05:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk - printf question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707816#M903744</link>
      <description>part part ... i meant part not party.&lt;BR /&gt;still in the weekend mood. monday morning arrived too fast :-)&lt;BR /&gt;&lt;BR /&gt;[N/A] pls.</description>
      <pubDate>Mon, 22 Apr 2002 05:15:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707816#M903744</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2002-04-22T05:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Simple awk - printf question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707817#M903745</link>
      <description>in awk ,  you can tell which outpout field separator you want to use. In your case you want to keep the | separator in outpout . You can write &lt;BR /&gt;awk -F\| 'BEGIN {OFS = "|" } &lt;BR /&gt;{ print $1,$2,...} ' file&lt;BR /&gt;&lt;BR /&gt;best regards &lt;BR /&gt;Marc&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Apr 2002 14:31:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-awk-printf-question/m-p/2707817#M903745</guid>
      <dc:creator>waknine</dc:creator>
      <dc:date>2002-04-23T14:31:27Z</dc:date>
    </item>
  </channel>
</rss>

