<?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 need remove second field in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776831#M640787</link>
    <description>Hi!&lt;BR /&gt;&lt;BR /&gt;I have a file which looks like this - &lt;BR /&gt;&lt;BR /&gt;host packagename -install -app Appname&lt;BR /&gt;&lt;BR /&gt;packagename is of this pattern - &lt;BR /&gt;&lt;BR /&gt;Appname-20110304-131123-hexanumbers&lt;BR /&gt;&lt;BR /&gt;1)The list is pretty long and I want to remove the packagenames from all entries. How can I remove the second entry from each row(delete the packagename)?&lt;BR /&gt;&lt;BR /&gt;2)Also it would be helpful if I can know how to remove the entries after Appname in the packagename.(so instead of Appname-20110304-131123-hexanumbers I can get Appname in the second field)?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;allan.</description>
    <pubDate>Wed, 13 Apr 2011 01:10:00 GMT</pubDate>
    <dc:creator>Allanm</dc:creator>
    <dc:date>2011-04-13T01:10:00Z</dc:date>
    <item>
      <title>need remove second field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776831#M640787</link>
      <description>Hi!&lt;BR /&gt;&lt;BR /&gt;I have a file which looks like this - &lt;BR /&gt;&lt;BR /&gt;host packagename -install -app Appname&lt;BR /&gt;&lt;BR /&gt;packagename is of this pattern - &lt;BR /&gt;&lt;BR /&gt;Appname-20110304-131123-hexanumbers&lt;BR /&gt;&lt;BR /&gt;1)The list is pretty long and I want to remove the packagenames from all entries. How can I remove the second entry from each row(delete the packagename)?&lt;BR /&gt;&lt;BR /&gt;2)Also it would be helpful if I can know how to remove the entries after Appname in the packagename.(so instead of Appname-20110304-131123-hexanumbers I can get Appname in the second field)?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;allan.</description>
      <pubDate>Wed, 13 Apr 2011 01:10:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776831#M640787</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2011-04-13T01:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: need remove second field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776832#M640788</link>
      <description>3) it would nice to know if I can add a text in the second field instead of the packagename.&lt;BR /&gt;(replace Appname-20110304-131123-hexanumbers with the word text)?</description>
      <pubDate>Wed, 13 Apr 2011 01:11:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776832#M640788</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2011-04-13T01:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: need remove second field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776833#M640789</link>
      <description>&lt;!--!*#--&gt;&amp;gt; How can I [...]&lt;BR /&gt;&lt;BR /&gt;Write a shell script?&lt;BR /&gt;&lt;BR /&gt;      man sed&lt;BR /&gt;&lt;BR /&gt;alp$ echo 'host Appname-20110304-131123-hexanumbers -install -app Appname' | \&lt;BR /&gt; sed -e 's/ [^ ]* / /'&lt;BR /&gt;host -install -app Appname&lt;BR /&gt;&lt;BR /&gt;alp$ echo 'host Appname-20110304-131123-hexanumbers -install -app Appname' | \&lt;BR /&gt; sed -e 's/-.*$//'&lt;BR /&gt;host Appname&lt;BR /&gt;&lt;BR /&gt;alp$ echo 'host Appname-20110304-131123-hexanumbers -install -app Appname' | \&lt;BR /&gt; sed -e 's/ [^ ]* / text /'&lt;BR /&gt;host text -install -app Appname&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It's not easy to do the whole job without&lt;BR /&gt;knowing from where "text" will be coming.&lt;BR /&gt;&lt;BR /&gt;      / [^ ]* /&lt;BR /&gt;means a space, any number ("*") of non-space&lt;BR /&gt;characters ("[^ ]"), and a space.&lt;BR /&gt;&lt;BR /&gt;      /-.*$/&lt;BR /&gt;means a "-", any number ("*") of any&lt;BR /&gt;characters ("."), and the end of the line&lt;BR /&gt;("$").&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      man sed</description>
      <pubDate>Wed, 13 Apr 2011 02:19:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776833#M640789</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-04-13T02:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: need remove second field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776834#M640790</link>
      <description>&lt;!--!*#--&gt;&amp;gt;1) How can I remove the second entry from each row (delete the packagename)?&lt;BR /&gt;&lt;BR /&gt;awk '{print $1, $3, $4, $5}' file&lt;BR /&gt;&lt;BR /&gt;&amp;gt;2) Also it would be helpful if I can know how to remove the entries after Appname in the packagename. (so I can get Appname in the second field)?&lt;BR /&gt;&lt;BR /&gt;Is this Appname the same as field 5?&lt;BR /&gt;awk '{print $1, $5, $3, $4, $5}' file&lt;BR /&gt;&lt;BR /&gt;Otherwise:&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;dash = index($2 , "-") # find "-"&lt;BR /&gt;if (dash == 0)&lt;BR /&gt;   app = $2&lt;BR /&gt;else&lt;BR /&gt;   app = substr($2, 1, dash-1)&lt;BR /&gt;print $1, app, $3, $4, $5&lt;BR /&gt;}' file</description>
      <pubDate>Wed, 13 Apr 2011 09:29:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776834#M640790</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-04-13T09:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: need remove second field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776835#M640791</link>
      <description>&amp;gt;3) it would nice to know if I can add text in the second field instead of the packagename.&lt;BR /&gt;awk -v text="$text_variable" '{print $1, text, $3, $4, $5}' file</description>
      <pubDate>Wed, 13 Apr 2011 10:01:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776835#M640791</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-04-13T10:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: need remove second field</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776836#M640792</link>
      <description>Hi Allan:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;2) Also it would be helpful if I can know how to remove the entries after Appname in the packagename. (so I can get Appname in the second field)?&lt;BR /&gt;&lt;BR /&gt;You can let 'awk' split subfields on a different deliminter, too:&lt;BR /&gt;&lt;BR /&gt;# X="host Appname-20110304-131123-hexanumbers -install -app Appname"&lt;BR /&gt;&lt;BR /&gt;# echo${X}|awk '{if (split($2,app,"-") &amp;gt; 0) {print $1,app[1],$3,$4,$5} else {print}}'&lt;BR /&gt;host Appname -install -app Appname&lt;BR /&gt;&lt;BR /&gt;As always, TMTOWTDI&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Apr 2011 12:09:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-remove-second-field/m-p/4776836#M640792</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-04-13T12:09:20Z</dc:date>
    </item>
  </channel>
</rss>

