I have this text file:
some text A=10 some text some more text A more text some other text A=30 other text I'm trying to use sed to capture only the numeric value of A. Using this
cat textfile | sed -r 's/.*A=(\S+).*/\1/' I get:
10 some more text A more text 30 But what i really need is:
10 0 30 If the string A= does not exist output a 0. How can I accomplish this?