I would like to extract substring after colon delimiter for my practical needs using GNU awk utility.
For example I can extract the temperature of hdd value using cut
as follows
hddtemp /dev/sda | cut -d ':' -f3
The same example written in sed
hddtemp /dev/sda | sed 's/.*\://'
For glory of Saint Completeness and GNU Trinity (awk, cut, sed)
I wonder, can GNU awk
do such thing?
Sample input: /dev/sda: ST500LT012-9WS142: 47°C
Required output: 47°C
... |awk '{ print $NF }'
– αғsнιη Oct 15 '18 at 15:27awk -F ":" '{print $NF}'
also works well.But in that topic the answer wasn't accepted.
– Twissell Oct 15 '18 at 15:34