Use awk along wit grep like this: sensors | grep -i cpu | awk '{print $2}'
this should produce "+53.4?C" given the output you provided. On Fri, 2003-06-27 at 16:49, Adam Bowns wrote: > Hello all, > > What I am trying to do is run a command and take a very specific part of > a line of its output and save it to a file. Here's the route i've been > going down so far... with no success might I add. > > the program im running is called sensors (lm_sensors) and run on its own > gives output of the temperatures of a handful of devices... I've > narrowed the output down to just the line im interested in with the > command > > sensors |grep CPU: |cat > cpu > > which gives me a file called cpu with contents: - > CPU: +53.4?C (limit = +120?C, hysteresis = +100?C) > > the problem im having is that i need the file to just contain: - > 53.4 > > or whatever the value was when sensors was run. i've tried variations of > this command like: - > > sensors |grep CPU: |grep -o +##.#? |cat > cpu > > but i just cant find a way to get it to do what i want. If any of you > know the command that will give me the output I'm looking for, or know a > different way of doing it, that would be fantastic. > > Thanks in advance, > Adam Bowns > -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list