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:
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:
...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.
I agree that awk is the tool for this.
It will handle changes in the length of disk names, etc.
better than some other approaches.
Assuming that more than one disk temp is on each input line,
this does something like what you seem to want.
It assumes that the right number of fields will always be provided after the disk name.
How to work x in sed command?
I know x command is swaps the contents of pattern space and hold space. But i am unable to understand it's working? (4 Replies)
Hello Experts..
I have 3-4 C codes with Oracle SQL statements embedded. All the SQL statements starts with EXEC SQL keyword and ends with ;. I want to extract all the SQL statements out of these codes.
I did awk '/^EXEC SQL/,/\;/' inputFile (I use this on all of the codes individually). That... (2 Replies)
Hi guys
I am trying to perform a substitution using 'awk' command, but it fails.
I work in ksh. Here is my code:
$ line="F 18:30 10 23:00 ts1632back"
$ n="ts1632back"
$ m="18:45"
$ echo ${line} | nawk -v a=$n -v b=$m '{if ($5==a) $2=m; print }'
F 10 23:00 ts1632back
$It should've... (2 Replies)
I have a html file with the following content:-
<font face=verdana color=#000000>108946</font>
<font face=verdana color=#000000>234346</font>
I want to format the values inside the font tag using thousand separator. I have the following command which can be used for adding thousand... (4 Replies)
how can I find cpu usage memory usage swap usage and
I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times
my final destination is monitor process
logical volume usage above X % and number of Logical voluage above
can I not to... (3 Replies)
Hi ,
I have a file as below.
Contents of the file are
--------------------
aaaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaaa
bbbbbbbbbbb
ccccccccccc
ddddddddddd
aaaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaaa
aaaaaaaaaaa
bbbbbbbbbbb (4 Replies)
Given this one long stream of data (all one line):
<TransactionDetail><TransactionHeader><ErrorLogging>YES</ErrorLogging><HistoryLogging>YES</HistoryLogging><ErrorDetection>NO</ErrorD... (4 Replies)
SunOS5.8 is a radical departure from SunOs4.X in many ways. one of the important differences is the handling of devices. Adding devices under SunOS4.x required a kernel reconfiguration, recompliation and reboot. Under SunOS5.X, this has changed with the ability to add some drivers on the fly.... (1 Reply)