Results 1 to 2 of 2

Thread: Grep issues

  1. #1
    Join Date
    Jan 2003
    Schaumburg, IL

    Unanswered: Grep issues

    I have a file which has the following data:

    Direct reads = 32
    Direct reads elapsed time (ms) = 23

    I am trying to get the values only using the following command:

    grep "Direct reads" db_snap1.out | cut -d= -f2

    Instead of getting the value from the first Direct reads, I am getting the value from both the rows.

    How can I make sure that it will bring back just the data for Direct reads alone?
    Naveen Urs
    DBA Manager
    IBM Certified Solutions Expert - DB2 LUW V7, V9

  2. #2
    Join Date
    Jun 2007
    The command grep "Direct reads" will only keep the lines that contain the text Direct reads. This means it will keep both the lines rather than just the first. I suggest you change your line slightly to something like :

    grep "Direct reads =" db_snap1.out | cut -d= -f2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts