LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux shell script for regular expression in expect command (https://www.linuxquestions.org/questions/linux-newbie-8/linux-shell-script-for-regular-expression-in-expect-command-4175584163/)

rahulevince 07-09-2016 03:02 AM

Linux shell script for regular expression in expect command
 
I need to match string and new line in regular expression or something like split in expect command. Here is the example - command output - Notification value: 34 39 48 Notification value: 44 02 09 Notification value: 54 03 28

I need to extract the output that match after "value: " i.e only hexa-value and up to every lines until second byte in last line must be 03 and also extract first bit i.e 5 from 54

But if 03 is in second line than it should not consider that 03. It must match at the end of line in every output.

One more thing, the lines of output is not fixed, it can be 3 or 4 or 5 or more than that. That's why we need to match in the last line and second byte i.e 03.

Thanks in advance

HMW 07-09-2016 09:37 AM

Quote:

Originally Posted by rahulevince (Post 5572973)
I need to match string and new line in regular expression or something like split in expect command. Here is the example - command output - Notification value: 34 39 48 Notification value: 44 02 09 Notification value: 54 03 28

I need to extract the output that match after "value: " i.e only hexa-value and up to every lines until second byte in last line must be 03 and also extract first bit i.e 5 from 54

But if 03 is in second line than it should not consider that 03. It must match at the end of line in every output.

One more thing, the lines of output is not fixed, it can be 3 or 4 or 5 or more than that. That's why we need to match in the last line and second byte i.e 03.

Thanks in advance

Hello and welcome!

Please post the EXACT infile (in code tags), and post EXACTLY what you want to achieve (in code tags) from that infile.
Then please show us what you have tried this far, and why and where it fails.

With best regards,
HMW

grail 07-09-2016 11:01 AM

To me that was as clear as mud ... sorry, but the entire description seems very unclear. You also have not shown any sign of attempting a solution yourself??


All times are GMT -5. The time now is 05:07 AM.