<?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: data extraction from file - help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148906#M717971</link>
    <description>Sorry, didn't notice we'd all done the same thing!&lt;BR /&gt;&lt;BR /&gt;how about I do it with perl then&lt;BR /&gt; &lt;BR /&gt;perl -n -e 'if(/Xref.+:(\d+)/){print "$1\n"}' &lt;DATAFILE&gt;&lt;/DATAFILE&gt;</description>
    <pubDate>Fri, 19 Dec 2003 04:16:13 GMT</pubDate>
    <dc:creator>Mark Grant</dc:creator>
    <dc:date>2003-12-19T04:16:13Z</dc:date>
    <item>
      <title>data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148902#M717967</link>
      <description>I have file format as given below...&lt;BR /&gt;First I need to find the line contating XRef. Then Extract the number 99 from that line into a variable. I will use that variable to create a New file. Following lines are there in the original file.&lt;BR /&gt;&lt;BR /&gt;#! rnews 0&lt;BR /&gt;Newsgroups: xxx&lt;BR /&gt;From: xxx&lt;BR /&gt;Subject: xxx&lt;BR /&gt;Date: xxx&lt;BR /&gt;Path: linux-nntp!forums-master!forums-1-dub!forums-1-dub!forums-master.sybase.com!forums-1-dub.sybase.com&lt;BR /&gt;Xref: linux-nntp sybase.test.xml:99&lt;BR /&gt;zzzzzzzzzzzzzzzzzzzzz</description>
      <pubDate>Thu, 18 Dec 2003 20:27:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148902#M717967</guid>
      <dc:creator>Praveen Hari</dc:creator>
      <dc:date>2003-12-18T20:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148903#M717968</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;x=`awk -F : '/Xref/{print $3}' &lt;FILENAME&gt;`&lt;BR /&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Thu, 18 Dec 2003 21:19:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148903#M717968</guid>
      <dc:creator>V.Tamilvanan</dc:creator>
      <dc:date>2003-12-18T21:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148904#M717969</link>
      <description>cat filename | awk -F : '/Xref/{print $3}' &amp;gt; newfilename&lt;BR /&gt;&lt;BR /&gt;John.</description>
      <pubDate>Fri, 19 Dec 2003 04:02:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148904#M717969</guid>
      <dc:creator>John Carr_2</dc:creator>
      <dc:date>2003-12-19T04:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148905#M717970</link>
      <description>grep Xref &lt;FILENAME&gt; | awk -F: '{ print $3 }'&lt;/FILENAME&gt;</description>
      <pubDate>Fri, 19 Dec 2003 04:12:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148905#M717970</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-19T04:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148906#M717971</link>
      <description>Sorry, didn't notice we'd all done the same thing!&lt;BR /&gt;&lt;BR /&gt;how about I do it with perl then&lt;BR /&gt; &lt;BR /&gt;perl -n -e 'if(/Xref.+:(\d+)/){print "$1\n"}' &lt;DATAFILE&gt;&lt;/DATAFILE&gt;</description>
      <pubDate>Fri, 19 Dec 2003 04:16:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148906#M717971</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-19T04:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148907#M717972</link>
      <description>Mark, one-liner code uses command line options :)&lt;BR /&gt;&lt;BR /&gt;# perl -nle'/^Xref.+:\s*(\d+)/&amp;amp;&amp;amp;print$1' file&lt;BR /&gt;&lt;BR /&gt;in a real script, it could be as&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt; m/^Xref\s*:.*:\s*(\d+)/ or next;&lt;BR /&gt; print "$1\n";&lt;BR /&gt; }&lt;BR /&gt;--&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 19 Dec 2003 05:54:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148907#M717972</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-12-19T05:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148908#M717973</link>
      <description>Part of the problem in your other post... It depends on whether it is always the third or last column, you can use awk or cut...&lt;BR /&gt;&lt;BR /&gt;If it is always the 3rd column:&lt;BR /&gt;grep -i '^xref:' | cut -d: -f3&lt;BR /&gt;&lt;BR /&gt;If it is always the last column:&lt;BR /&gt;awk -F: '/XRef/ {print $NF}'&lt;BR /&gt;&lt;BR /&gt;Mind one thing: awk will not match any line now, because XRef != Xref, that's why I used the liberty to use the -i option to grep.</description>
      <pubDate>Fri, 19 Dec 2003 05:55:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148908#M717973</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-12-19T05:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148909#M717974</link>
      <description>Elmar, please mail me at h dot m dot brand at procura dot nl&lt;BR /&gt;&lt;BR /&gt;no points please :)</description>
      <pubDate>Fri, 19 Dec 2003 06:13:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148909#M717974</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-12-19T06:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148910#M717975</link>
      <description>When I run &lt;BR /&gt;awk -F: '/XRef/ {print $NF}' filename &amp;gt; filename1&lt;BR /&gt;It writes correct output into filename2.&lt;BR /&gt;But if I put the same command on a script file named 1.csh and run it, it doesn't out the results into filename2.&lt;BR /&gt;&lt;BR /&gt;Can some one help me why it doesn't work ???</description>
      <pubDate>Fri, 19 Dec 2003 14:54:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148910#M717975</guid>
      <dc:creator>Praveen Hari</dc:creator>
      <dc:date>2003-12-19T14:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148911#M717976</link>
      <description>Hi,&lt;BR /&gt;make a small correction, change:&lt;BR /&gt;XRef&lt;BR /&gt;to&lt;BR /&gt;Xref&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Sat, 20 Dec 2003 09:31:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148911#M717976</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-12-20T09:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: data extraction from file - help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148912#M717977</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;no offense, but could you tell, what still your problem is? You have got all the answers in the preceeding threads. Why open another one for this?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Sat, 20 Dec 2003 19:10:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-extraction-from-file-help/m-p/3148912#M717977</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-20T19:10:26Z</dc:date>
    </item>
  </channel>
</rss>

