How do I convert to an Integer with the Command Line?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Xubuntu Natty on Lenovo R61i Thinkpad
Posts: 108
Original Poster
Rep:
Thank you, bigrigdriver. That worked great. Is that an online guide, or a hardcopy book? If it is a book, can you give me the ISBN#? I would like to purchase it. Also, any other books you could recommend for basic Linux knowledge would be great. Again, thanks for the help.
The Effective AWK Programming guide is free, both on-line and download. Just use www.google.com/linux to search for it.
Also look for (all free):
Absolute Bash-scripting Guide
Bash Guide for Beginners
Effective c++
Thinking in c++
Byte of Python
Dive into Python
Thinking in Pyghon
Rute User's Tutorial
Linux Administration Made Easy
That should keep you busy for a couple of days.
When you're done reading those, let me know. I have a bunch of sites bookmarked, but 7 or 8 stand out as on=line libraries and repositories of tutorials, etc that you can explore.
Last edited by bigrigdriver; 02-15-2007 at 01:38 PM.
The "GAWK: Effective AWK Programming" is one of the best books I have ever read. No kidding. Look for the official release at http://www.gnu.org/software/gawk/manual/
Distribution: Xubuntu Natty on Lenovo R61i Thinkpad
Posts: 108
Original Poster
Rep:
Another Question about the Command Line
Ok, Thanks. I work 40 hours a week, go to school full time, have 3 kids and a wife....but I always find time to read when it comes to Linux. One more question maybe you can answer off the top of your head...
I have a karamba script that displays the temperature of my CPU. It does so with the following command:
The output is in celsius, I would like it in Fahrenheit. I have a program that converts from C to F with the following command:
$ tempconv 58 c
would give the temp in F, how can I pipe the previous command into this one? It all has to be on one line. Of course if you know another way using the C to F formula and can get it all in one line, I'm all ears.
Distribution: Xubuntu Natty on Lenovo R61i Thinkpad
Posts: 108
Original Poster
Rep:
Well, that was a good thought. I tried that but tempconv needs to see a "c" after the temperature to know it is converting from C to F. So I came up with the following command, and look at the outputs:
[falcon56215@localhost ~]$ cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2" c"}'
52 c
[falcon56215@localhost ~]$ cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2" c"}' | tempconv
Temperature Converter
To Convert from Fahrenheit to Celsius press f
To Convert from Celsius to Fahrenheit press c
tempconv - converts a value to/from degrees Farenheit from/to
degrees Celcius.
usage:
tempconv [<value> <f|c>] | [h|help|-h|--help]
with no options, it interactively prompts for values.
or you can give it the necessary info on the command line very simply
and automatically get the right answer back with no other output, for
use in scripts. Examples:
You have a temperature reading from your motherboard cpu sensor in
degrees C. You want to know what that is in degrees F...
you type: tempconv 24 c
tempconv returns: 75
tempconv --help or -h or h or help shows this message.
[falcon56215@localhost ~]$ tempconv 52 c
125
[falcon56215@localhost ~]$ cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2" c"}'
52 c
[falcon56215@localhost ~]$ cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2" c"}' | tempconv
Temperature Converter
To Convert from Fahrenheit to Celsius press f
To Convert from Celsius to Fahrenheit press c
tempconv - converts a value to/from degrees Farenheit from/to
degrees Celcius.
usage:
tempconv [<value> <f|c>] | [h|help|-h|--help]
with no options, it interactively prompts for values.
or you can give it the necessary info on the command line very simply
and automatically get the right answer back with no other output, for
use in scripts. Examples:
You have a temperature reading from your motherboard cpu sensor in
degrees C. You want to know what that is in degrees F...
you type: tempconv 24 c
tempconv returns: 75
tempconv --help or -h or h or help shows this message.
[falcon56215@localhost ~]$
...almost like the pipe is not happening. Any thoughts?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.