The mentioned values are the hexadecimal values. I need to get the values of thewall and allocated respectively. The problem here is that there can be n number of dots(.) and I am unable to retrieve the respective hexadecimal values because number of dots might vary from server to server.
s/.*thewall[.][.]* (match anything followed by "thewall" followed by one dot followed by zero or more dots)
\([^[:blank:]]*\) (match and capture anything that is not a blank/return)
.* (match anything else)
/\1/ (replace with captured match)
p (print it)
You'd can use the -e option to sed to do multiple things, so you can repeat the construct for "allocated". There could be a problem if there are strings like "anotherthewall" or "somethingelseallocated".
If it finds a line with "the wall" followed by at least one dot, then it replaces everything on the line, except the part after the dots, this is signified by
\([^[:blank:]]*\)
which means zero or more characters that are not a space. De escaped parentheses signify a nested subexpression, which is referenced in the replacement part by \1 .
The -n option means do not print, while the p-flag at the end means "print if the substitution was successful"