I have a variable called inet that contains the following line:
inet="inetnum: 10.19.153.120 - 10.19.153.127"
I would like to convert this line to the notation below:
10.19.153.120 10.19.153.127
I could easily achieve this with sed 's/^inetnum: *//;s/^ -//' , but I would prefer a more compact / elegant solution and use bash. The nested parameter extension also does not work:
$ echo ${${inet//inetnum: /}// - / } bash: ${${inet//inetnum: /}// - / }: bad substitution $
Any other suggestions? Or should I use sed this time?
source share