|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
bash script to display words in parentheses
I have this:
var="I said ( hello world ) and the world said hello back." var=${var#*(} echo ${var%)*} which outputs: hello world as expected. However, I am trying to simply turn that into a one-liner which I've been completely unsuccessful with. The reason is that it has no significant advantage currently over cut/ awk/sed solutions as the variable is being re-defined. Does anybody know how I can turn the above into a one-liner? The following command (and many other variants) do not work: echo ${var#*(%)*} Any help would be much appreciated. Thanks. |
![]() |
| Viewing: Web Development Archives > FAQs > Unix/Linux > bash script to display words in parentheses |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|