I have a file as below:
This is an _PLUTO_
This is _PINEAPPLE_
This is _ORANGE_
This is _RICE_
I'm using below code to extract the output:
awk '{ print "Country: " $NF }' report.txt
Output:
Country: _PLUTO_
Country: _PINEAPPLE_
Country: _ORANGE_
Country: _RICE_
How do I remove all the underscore so that my output looks below:
Country: PLUTO
Country: PINEAPPLE
Country: ORANGE
Country: RICE
substrorgsub- see gnu.org/software/gawk/manual/gawk.html#String-Functionsawk -F_ '{print "Country: " $2}'would also work.