I'm going to guess that what you want to do is to "match data in column 2 of a file if the current or previous non-blank entry in column 1 matches another condition". I'd also guess that Excel doesn't have anything to do with the problem.

I'm guessing this because, despite being given the opportunity to do so, you haven't explained clearly what you want to do.

Here is an example program based on the above assumptions:

#!/usr/bin/perl -w use strict; my $pattern1 = qr/encryption/; my $pattern2 = qr/encryption/; my $in_match = 0; while (<DATA>) { next unless /\S/; # Skip blank lines chomp; my ($command, $output) = split /\|/; if ($command =~ /\S/) { $in_match = $command =~ $pattern1; } if ($in_match and $output =~ $pattern2) { print $_, "\n"; } } __DATA__ Command | output show run in encryption | service password-encryption | fsddfsfsdfsdfsd sdfs sd | encryption | foo show ntp status | clock synchronised. 34.45.54.54 | some other text encryption1 | encryption2

If this program isn't something like what you are looking for then you are really going to have to show a clear example in code or pseudo-code of what you are trying to do, with clear input and expected output.

--
John.


In reply to Re: data formatting in excel by jmcnamara
in thread data formatting in excel by pingme8705

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.