I am new to bash script. I need help in parsing a text file (say sample.txt) which contains the data like below
*AR eth0 ethernet0
*A eth1 ethernet1
eth2 ethernet3
ethernet4
*A eth5 ethernet5
T E S T ethernet6
I want the output like below
eth0
eth1
ethernet3
eth5
T E S T
I have used below command, but it did not worked
sed 's/^ {1,}/SPACE_PLACEHOLDER/g' sample.txt | awk '{print $2}' | sed 's/SPACE_PLACEHOLDER/ /g'