AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  grep and regular expression

    Posted Wed June 11, 2008 06:38 PM

    Originally posted by: SystemAdmin


    Hello,

    How can I grep in a file for a line which contains "Final Lable" and ends with "proceed to the next level."

    Lets say my file looks like"

    Wed Testing is complete-Final Lable-1234XB proceed to the next level.
    complete-final
    This is just an extra line-proceed to the next level
    Thu Testing is complete-Final Lable-1234XB proceed to the next level.

    and I want the out put of my grep shows

    Wed Testing is complete-Final Lable-1234XB proceed to the next level.
    Thu Testing is complete-Final Lable-1234XB proceed to the next level.
    please help. thank you
    #AIX-Forum


  • 2.  Re: grep and regular expression

    Posted Wed June 11, 2008 07:02 PM

    Originally posted by: orphy


    Here's one way to do it.

    $ grep 'Final Lable' o | grep 'proceed to the next level.$'
    Wed Testing is complete-Final Lable-1234XB proceed to the next level.
    Thu Testing is complete-Final Lable-1234XB proceed to the next level.
    $
    Orphy
    #AIX-Forum


  • 3.  Re: grep and regular expression

    Posted Fri June 13, 2008 12:32 PM

    Originally posted by: SystemAdmin


    $ grep 'Final Lable.*proceed to the next level\.$' name_of_file_to_grep
    #AIX-Forum