OpenWrt Forum Archive

Topic: Openwrt - sed, help with script

The content of this topic has been archived on 20 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

How are your colleagues?

I am making a script to collect data from an external file. In the middle of this, I saw myself having trouble with the following sed command to limit the result to a single line.

The following command searches for all words with "value =" by collecting the next number, ignoring rows with "#"

NUM=$(sed -n -e '/#/!s/^.*value=//p' $LOGFILE)

I found other command variations for this but none of them allowed the use of words to be ignored as is the case with this command line.

Any soul to do this capture only the final line and stop the reading by printing the result?

Thank you for your attention!

(Last edited by murilo.xd on 27 Aug 2017, 23:31)

murilo.xd, I don't understand, what you want. Use tail to capture last n lines.

In any case, sed is not OpenWrt specific and the net has better and quicker answers for you than the OpenWrt forum, e.g. https://stackexchange.com/.

The discussion might have continued from here.