in reply to Search and delete

Welcome to the Monastery.

Please, put the data part of your question in < code > tags, it's impossible to see the lines you are referring to. Look at the Writeup Formatting Tips to find out how to format your data and code.

Have you already tried something to match those lines? If yes, what went wrong?

- Luke

Replies are listed 'Best First'.
Re^2: Search and delete
by pr33 (Scribe) on Dec 15, 2014 at 23:45 UTC
    Hi, Thanks, for getting back to me . This are the lines that I wanted to delete . This is what I have tried after opening the File descriptor from my command output . next if $row =~ /^unassigned\n\nOK$/; Below are the lines to be deleted < unassigned physicaldrive 7C:3:7 port 7C:box 3:bay 7 SAS 1 TB OK physicaldrive 7C:3:8 port 7C:box 3:bay 8 SAS 1 TB OK >

      Have you read my response? Please apply some basic formatting to your post, it's completely unreadable right now.

      Can you see four lines in the following output?

      asdfghjklqwertyuiop

      And now?

      asd fghjkl qwertyu iop

      You can always count on people willing to help you in the Monastery. Make it possible for them by not forcing them to guess what your question is.

      - Luke

        Sorry, I am new to this forum . Finding it difficult to understand to post here . Here is my code .
        my %unitMap; my $cmd = "hpacucli ctrl slot=0 pd all show";; open my $fd, "$cmd|" or return \%unitMap; while (my $row = <$fd>) { $row =~ /^$/ and next; $row =~ s/[,|)|(]//g; chomp $row; next if $row =~ /^Smart/g; $row =~ s/^\s+//; next if $row =~ /^unassigned\n\nOK$/; # I am trying to delete the line that starts with unassigned and 2 lin +es after that print "$row\n";
      Um, thats not code tags :)  <code> code here </code>
      unassigned -> line 1 to be matched physicaldrive......OK -> line2 physicaldrive ...Ok -> line3