<?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 grep string from compressed file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032085#M761409</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have created a 500mb file by concatenating lots of small files together:&lt;BR /&gt;&lt;BR /&gt;file:abc.txt&lt;BR /&gt;data&lt;BR /&gt;data&lt;BR /&gt;data&lt;BR /&gt;:EOF&lt;BR /&gt;&lt;BR /&gt;I have then compressed the file.  What I would like to know is the command that can extract all the data between file:abc.txt and :EOF without uncompressing the file.&lt;BR /&gt;&lt;BR /&gt;I have installed gnu.grep (zgrep) which can find the string in that file.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
    <pubDate>Tue, 06 Mar 2007 08:52:19 GMT</pubDate>
    <dc:creator>lawrenzo_1</dc:creator>
    <dc:date>2007-03-06T08:52:19Z</dc:date>
    <item>
      <title>grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032085#M761409</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have created a 500mb file by concatenating lots of small files together:&lt;BR /&gt;&lt;BR /&gt;file:abc.txt&lt;BR /&gt;data&lt;BR /&gt;data&lt;BR /&gt;data&lt;BR /&gt;:EOF&lt;BR /&gt;&lt;BR /&gt;I have then compressed the file.  What I would like to know is the command that can extract all the data between file:abc.txt and :EOF without uncompressing the file.&lt;BR /&gt;&lt;BR /&gt;I have installed gnu.grep (zgrep) which can find the string in that file.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Tue, 06 Mar 2007 08:52:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032085#M761409</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-03-06T08:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032086#M761410</link>
      <description>How did you concatenate the files together?  &lt;BR /&gt;"cat"?  &lt;BR /&gt;&lt;BR /&gt;If so, I doubt that there are any file header indicators in the file - so all you could use to key off of for the end of abc.txt would be whatever the last piece of text is in abc.txt file.&lt;BR /&gt;&lt;BR /&gt;Re; the second requirement of not uncompressing.  Well you're going to have to uncompress either via your own code or some code from a program that understands the compression for that file - but you're going to have to uncompress.&lt;BR /&gt;&lt;BR /&gt;UNLESS, you mean you don't want to uncompress to a file - you could uncompress to a pipe.  Is that the question here, how to retrieve the 3 data files from a pipe which has uncompressed the file ?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Mar 2007 09:04:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032086#M761410</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2007-03-06T09:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032087#M761411</link>
      <description>What did you use to compress the file?  gzip or compress?&lt;BR /&gt;&lt;BR /&gt;If you used gzip, try the following:&lt;BR /&gt;&lt;BR /&gt;# gzcat file.gz | grep whatever&lt;BR /&gt;&lt;BR /&gt;If you used compress, try the following:&lt;BR /&gt;&lt;BR /&gt;# zcat file.Z | grep whatever</description>
      <pubDate>Tue, 06 Mar 2007 09:07:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032087#M761411</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-03-06T09:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032088#M761412</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;# gzip -d -c file|perl -nle 'print if /abc.txt/../:EOF/'&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 06 Mar 2007 09:10:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032088#M761412</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-06T09:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032089#M761413</link>
      <description>Chris,&lt;BR /&gt;can't you use something like:&lt;BR /&gt;zgrep -v -e'^file:' -e'^:EOF' input &amp;gt; output</description>
      <pubDate>Tue, 06 Mar 2007 09:12:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032089#M761413</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-03-06T09:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032090#M761414</link>
      <description>ok thanks guys.&lt;BR /&gt;&lt;BR /&gt;to create the files I ran a small script&lt;BR /&gt;&lt;BR /&gt;for aa in `ls dir`&lt;BR /&gt;echo "file:$aa"&amp;gt;&amp;gt;$outfile&lt;BR /&gt;cat $aa &amp;gt;&amp;gt; $outfile&lt;BR /&gt;echo ":EOR" &amp;gt;&amp;gt;$outfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I will try gzcat.</description>
      <pubDate>Tue, 06 Mar 2007 09:12:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032090#M761414</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-03-06T09:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032091#M761415</link>
      <description>ok lots more ideas to try here ....&lt;BR /&gt;&lt;BR /&gt;I am playing with the gzip utility which works well to extract the string I require however the string is a unique number and will only appear once therefore once the string has been found then the search should stop.&lt;BR /&gt;&lt;BR /&gt;here is what I require:&lt;BR /&gt;&lt;BR /&gt;string to search is BGM001025176958&lt;BR /&gt;&lt;BR /&gt;I need to recreate the file that was orginally on the server:&lt;BR /&gt;&lt;BR /&gt;file:abc.txt&lt;BR /&gt;data&lt;BR /&gt;data&lt;BR /&gt;BGM001025176958&lt;BR /&gt;data&lt;BR /&gt;:EOR&lt;BR /&gt;&lt;BR /&gt;so once the string has been identified then I want to create the file abc.txt containing &lt;BR /&gt;&lt;BR /&gt;data&lt;BR /&gt;data&lt;BR /&gt;BGM001025176958&lt;BR /&gt;data&lt;BR /&gt;&lt;BR /&gt;I have an idea howevr my awk syntax ain't quite correct.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 06 Mar 2007 09:31:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032091#M761415</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-03-06T09:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032092#M761416</link>
      <description>&lt;BR /&gt;Here is some awk that would do what you desire:&lt;BR /&gt;&lt;BR /&gt;awk -F: '/BGM001025176958/{p=1} /^:EOR/ &amp;amp;&amp;amp; (p) {while (i&lt;N&gt; name} exit} {a[n++]=$0} /^file /{name=$2; n=0}'&lt;BR /&gt;&lt;BR /&gt;C:\Temp&amp;gt;type abc.txt&lt;BR /&gt;file aaa.txt&lt;BR /&gt;data&lt;BR /&gt;BGM001025176958&lt;BR /&gt;data&lt;BR /&gt;&lt;BR /&gt;With comments....&lt;BR /&gt;&lt;BR /&gt;/BGM001025176958/{p=1}   ## Desired pattern? Set print flag!&lt;BR /&gt;&lt;BR /&gt;/^:EOR/ &amp;amp;&amp;amp; (p)   ## Line starting with end mark? Also have print flag set? then...&lt;BR /&gt;{while (i&lt;N&gt;&lt;/N&gt;{print a[i++] &amp;gt; name} ## Print onto fresh file with remembered name&lt;BR /&gt;exit} ## and done&lt;BR /&gt;&lt;BR /&gt;{a[n++]=$0}'  ## Remember every line in  its own place.&lt;BR /&gt;&lt;BR /&gt;/^file:/ {name=$2; n=0}  ## Line starting with new file? remember name part and reset number of lines.&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;/N&gt;</description>
      <pubDate>Tue, 06 Mar 2007 12:08:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032092#M761416</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-03-06T12:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032093#M761417</link>
      <description>The command isn't returning anything ....&lt;BR /&gt;&lt;BR /&gt;any other idea's?&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 07 Mar 2007 07:41:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032093#M761417</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-03-07T07:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032094#M761418</link>
      <description>&lt;!--!*#--&gt;&amp;gt;The command isn't returning anything&lt;BR /&gt;&lt;BR /&gt;I got an error message showing the problem:&lt;BR /&gt;awk: A print or getline function must have a file name.&lt;BR /&gt;&lt;BR /&gt;I then initialized name to "bad_news" and got the output.&lt;BR /&gt;&lt;BR /&gt;The problem is an extra space after the "e" in file.  I fixed it here:&lt;BR /&gt;/^file/{name=$2; n=0}&lt;BR /&gt;&lt;BR /&gt;It might be easier to read as:&lt;BR /&gt;awk -F: '&lt;BR /&gt;BEGIN { name="bad_news" }&lt;BR /&gt;/BGM001025176958/{p=1}&lt;BR /&gt;/^:EOR/ &amp;amp;&amp;amp; (p) {while (i&lt;N&gt; name } exit}&lt;BR /&gt;{a[n++]=$0}&lt;BR /&gt;/^file/{name=$2; n=0}'&lt;BR /&gt;&lt;/N&gt;</description>
      <pubDate>Wed, 07 Mar 2007 07:55:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032094#M761418</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-03-07T07:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032095#M761419</link>
      <description>&amp;gt; &amp;gt;The command isn't returning anything &lt;BR /&gt;&lt;BR /&gt;Ooops, like Dennis indicates i made a cut &amp;amp; paste error. I tried it on a Windoze box and the awk had trouble with specifying a ":" as field seperator. So I changed the data to use spaces, for the test replacing them in the posted string.. except for the /^file:/ match. Sorry.&lt;BR /&gt;&lt;BR /&gt;And, You need to feed (pipe) it the input stream of course, &lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Mar 2007 08:02:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032095#M761419</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-03-07T08:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032096#M761420</link>
      <description>that now works a treat!&lt;BR /&gt;&lt;BR /&gt;Thanks guys.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 07 Mar 2007 08:04:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032096#M761420</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-03-07T08:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: grep string from compressed file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032097#M761421</link>
      <description>ty ty ty</description>
      <pubDate>Wed, 07 Mar 2007 08:40:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-string-from-compressed-file/m-p/5032097#M761421</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-03-07T08:40:27Z</dc:date>
    </item>
  </channel>
</rss>

