I need a little help with sed. Basically, I need to parse out selections from the output of hddtemp so conky can display some hdd temps for me. I have hddtemp in daemon mode so A simple 'nc localhost 7634' displays the following:
$ nc localhost 7634
|/dev/sg1|ST3640323AS|31|C||/dev/sg2|ST3640323AS|31|C||/dev/sg3|WDC WD1001FALS-00J7B1|36|C||/dev/sg4|WDC WD7501AALS-00J7B0|32|C||/dev/sda|ST3640323AS|31|C||/dev/sdb|ST3640323AS|31|C||/dev/sdc|WDC WD1001FALS-00J7B1|36|C||/dev/sdd|WDC WD7501AALS-00J7B0|32|C|
Just ignore /dev/sdd because it's going away soon. How can I use sed to extract the temps of /dev/sda and /dev/sdb and /dev/sdc so I can insert an appropriate line to my .conkyrc?
I have can do this long hand using the '-cut -cx-y' command:
sda:$color ${execi 300 nc localhost 7634 | cut -c50-51} C
...but I think a series of sed statements would be more power (one to delete everything up to the temp and one to delete everything after the temp) particularlly if the HDD gets swapped out which would change the number of characters in the line.
Thoughts are welcomed and thanks!