Need Grep help

Clovertech Forums Read Only Archives Cloverleaf General Need Grep help

  • Creator
    Topic
  • #51357
    Andrew Deters
    Participant

      I need to grep for the following:

      PM||12345678912345||ADT^Z46

      where 12345678912345 is the date and time the message was sent.  Can anybody help me out?

    Viewing 6 reply threads
    • Author
      Replies
      • #69864

        Andrew Deters wrote:

        I need to grep for the following:

        PM||12345678912345||ADT^Z46

        where 12345678912345 is the date and time the message was sent.

        -- Max Drown (Infor)

      • #69865
        Andrew Deters
        Participant

          that would appear to match on all lines for some reason.

          i used the command

          egrep -E ‘PM||[0-9]+||ADT^Z46’

          also tried

          egrep ‘PM||[0-9]+||ADT^Z46’

          both times all rows are returned.

          but maybe the message files are seen as all one line

        • #69866
          David Barr
          Participant

            Code:

            grep ‘PM||12345678912345||ADT^Z46’

            The pipes are special characters in egrep, but you stick with grep, you only have to worry about the caret.

          • #69867

            I’m assuming that “12345678912345” needs to be a pattern? Or is that the actual string you want to search for?

            Can you paste a few sample lines here?

            -- Max Drown (Infor)

          • #69868
            Andrew Deters
            Participant

              They are message files from smat. but they look like

              MSH|^~&|NE|NE|PM|20091109235806||ADT^Z46……..more message out this way.

              I think i have bigger problems than this because those files aren’t line delineated.  They are all one line.

              any ideas on how to pull just the messages that have the search string in them and not the entire file?

            • #69869
            • #69870
              Andrew Deters
              Participant

                That’s what it was.  I used msgExtract.pl to convert the file then the egrep command worked like a charm.

                thanks

            Viewing 6 reply threads
            • The forum ‘General’ is closed to new topics and replies.