Programming :: Complex Math Calculation In Shell Script?
Feb 16, 2010
Here is my situation:I have a series of .plt files that are geared for a device that has it's xy origin at the lower left of the paper however some devices use the center of the paper as it's origin in a piped shell script how can I convert this file to a center origin plot file?Here are some knowns: the existing file always Lower Left 0.0 the existing file max xy is the page upper right x.x the desired output file must have it's 0.0 at the exact center of page (page size will vary). Ideas: Based on the sample files included maybe use PU and PD as the triggers for inputs to be calculated as any other commands have nothing to do with coordinates.
Code: loopbit = loops_per_jiffy; /* Gradually work on the lower-order bits */ while (lps_precision-- && (loopbit >>= 1)) { loops_per_jiffy |= loopbit; ticks = jiffies; while (ticks == jiffies); /* Wait until the start
Why are basic math problems returning 0? I know that Integers can only hold whole numbers, and it had the exact same problem when I used floats. I am using GCC 4.4.4.
I've started programming in c recently . following are the details about scene:
* vim is editor and program is compiled in gcc whenever a program involving math function appears it gives error i.though math.h is included in header file compiler complains about it it gives error of unrecognized function that math function like sqrt, etc question is how to connect math.h to a program.
I wrote a perl script to feed information to our load balancer: Code: #!/usr/bin/perl # use strict; #use warnings; # # use Net::SSH::Perl; my $user="bluethundr"; my $pass="secret"; my $dir="$ENV{HOME}/data"; open (LBVSERVERS), '<', "$dir/lb-vserver" or die "Couldn't open file: $!"; open (CSVSERVERS), '<', "$dir/cs-vserver" or die "Couldn't open file: $!"; my $ssh = Net::SSH::Perl->new("10.50.0.1"); $ssh->login("$user", "$pass"); print " .....
I need to be able to install the Math::Pari CPAN module in order to accomodate the Net::SSH CPAN module. The prereqs are installed: Code: cpan> install Net::FTP Net::FTP is up to date. cpan> install LWP::UserAgent LWP::UserAgent is up to date.
But when I either try to install or force install Math::Pari this is what I get: Code: cpan> install Math::Pari Running install for module Math::Pari Running make for I/IL/ILYAZ/modules/Math-Pari-2.01080604.tar.gz Checksum for /home/bluethundr/.cpan/sources/authors/id/I/IL/ILYAZ/modules/Math-Pari-2.01080604.tar.gz ok Math-Pari-2.01080604/ .....
CPAN.pm: Going to build I/IL/ILYAZ/modules/Math-Pari-2.01080604.tar.gz Did not find GP/PARI build directory around. Do you want to me to fetch GP/PARI automatically? (If you do not, you will need to fetch it manually, and/or direct me to the directory with GP/PARI source via the command-line option paridir=/dir) Make sure you have a large scrollback buffer to see the messages, or 'tee' the STDOUT/STDERR to a file. Fetch? (y/n, press Enter) y Getting GP/PARI from ftp://megrez.math.u-bordeaux.fr/pub/pari/unix/ Cannot list (Failed to establish connection. ): at utils/Math/PariBuild.pm line 319, <STDIN> line 1. Can't fetch file with Net::FTP, now trying with LWP::UserAgent... You do not have LWP::UserAgent and/or HTML::LinkExtor installed, cannot download, exiting...
I need to replace a line in the lvm.conf file from: filter = [ "r|/dev/.*/by-path/.*|", "r|/dev/.*/by-id/.*|", "a/.*/" ] to: filter = [ "a|/dev/cciss/c0d0.*|", "a|/dev/disk/by-id/.*|", "r|.*|" ] And I was hoping there was a way to use sed or awk to do this in a script (as I need to repeat this on several machines).
All of the examples I've found don't see to work with all of the special characters in the line that I need to replace. Then I need to add a line after the above edit like this: types = [ "device-mapper", 253 ]
I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.
Code: if [ $# -eq 0 ] ; then d=`pwd` for i in * ; do if test -d $d/$i ; then echo "$i:" code....
Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?
Example:
Code:
>>> import subprocess >>> help(subprocess) ... [pages of stuff to read] ...
I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.
I am having problems with the useradd command. When I call "useradd someuser" the program starts and never finish. When I give the UID option (useradd -u ) sometimes it works properly, but with some UID's that aren't in /etc/passwd it shows a message saying that the uid is not unique. I checked out /var/log/auth.log and nothing about the command is being logged. It seems that the command is not calculating the new UID prperly.It's running on a Debian Linux 2.6.26-2-686 i686 GNU/Linux
I am running a 64 bit RHEL 4 in one of mymachines with 8 Gb of physical memory.But when I run the top command, it outputs as below: Code:
Mem: 8165428k total, 8109988k used, 55440k free, 65772k buffers Swap: 4194296k total, 135596k used, 4058700k free, 6739936k cached On calculation, it shows it has only 7.7 Gb of memory if I calculate ( using 1 Gb = 1024*1024 Kb).
Where is .3Gb gone ? Again, it is a 64 bit machine..so should see all 8Gb. Is it mistake of top command calculating 1Gb=1024*1000Kb ?
I got an error Upgrades calculation is not possible An unresolvable problem occurred while calculating the upgrade: E:Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. This can be caused by:
* Upgrading to a pre-release version of Ubuntu * Running the current pre-release version of Ubuntu * Unofficial software packages not provided by Ubuntu
I am basically from system side and often confused about the calculation of the IP addresses.Just i want to know that what how can i calculate the following of a IP Address:
(1) Available IP in a Network (2) Broadcast IP (3) Network Prefix or Net Mask
i am working on a model based on cpu load / cpu usages. where i need the instant cpu usage/cpu load, but i can able to find the cpu load average for last 1 , 5 or 15 minutes. Is there any command or any software by which i can able to find out that?
ipcalc isn't the one I am thinking of. I remember another one that was a bit better, with more options -- easier to use.I remember that if you gave it a CIDR network /23 and an IP, it would list all of the address ranges, network, broadcast for that network..
I've created a simple script based menu. This menu will be accessed by only a certain users via ssh.When user logs in, the menu will automatically run. (configured at user's .bash_profile).How do I force the session to close when user hits Ctrl-C or Ctrl-Break ?In a nutshell, I don't want user to have access to shell.
I just built a VMWare VM from the Fedora 13 DVD - 64 bit. It now wants to do 385 updates so I let it download all of the rpms. As it starts to do the install I get a Transaction Error to the effect
Quote:
Test Transaction Errors: installing package kernel-2.6.34.6-47.fc13.x86_64 needs 8MB on the /boot filesystem
System monitor shows that I have 19.7 MiB available on /boot - so what is going on?
I know several tools that allow tracking time spend on different tasks / projects.Is there any existing tool for very very simplified work-time-tracking.I am an employee, come to the office, switch on my laptop directly. I have mostly around 1 hr lunchtime, but sometimes less, sometimes more.At around 18:00 I want to type one command in the console (or simple GUI would also be okay of course) that tells me:"1 hour overworked. Go home now! (came at 8:00, 1 hour standard lunch-break)."
I have an HP Laserjet 2200 connected via USB with 64MB of memory. When I print page 2 of this document (for example) [URL] the delta-symbol and minus-signs do not show up, although I see them in Adobe reader version 9.3.
I have tried several of the available drivers for the printer (including the "[recommended]" one) and none of them produce these symbols.
I'm guessing this is a font issue. I don't know how to show you what font stuff I have installed.
I have a user that wants to use basic math functions from the command line like sqrt and such. Apparently it was installed on the previous server we were using, but not on this new Debian server by default.
I recently started shell programming and my task now is to do a menu display.Currently i am stuck whereby user will input both title and author and it will delete it.
I've been trying to ssh out of my home network to school computers and I keep getting:
ssh: connect to host sage.math.washington.edu port 22: Connection timed out
I've tried this on my machine (running Ubuntu 10.04) and on a windows 7 machine (using putty). I have been successful ssh'ing to this machine using either of the laptops from every other network I've tried, so I'm pretty sure it's something about my home network.
Is it possible to assist in the programming Shell Scripts Job: To send a message to the email,All orders written in Terminal or ssh example : ls , pwd , cat , and other
I have a simple log file which is very messy and I need it to be neat. The file contains log headers but are all jumbled up together thereforeI need to sort the log files according to the log headers. There are no static number of lines that means that there is no fix number of lines for the each header of the text file. And I am using AWK to sort out the headers.The Log files goes something like this:
I have a simple log file which is very messy and I need it to be neat. The file contains log headers but are all jumbled up together therefore I need to sort the log files according to the log headers. There are no static number of lines that means that there is no fix number of lines for the each header of the text file. And I am using AWK to sort out the headers.
We're going to be doing a rather large server deployment, and using the provisioning system we have in place there is no current way to just "copy" a file over to the servers. All files/scripts have to be run from the provisioning server.Due to network constraints, the provisioning system can't run a script we need to run (requires certain network assets to complete, but as soon as we modify the network settingshe provisioning system loses access to the server and can't run the script). So,our network configuration script to create the other script on the server in /root when it runs.My original method was to do something along the lines of:
I've got a fairly complex bit of code (a for loop within a for loop) which I'm trying to execute remotely, however because of the special characters this exits without making the connection.Usually I'd do:ssh root@ipaddress "for i in `cat /etc/hosts | awk '{print $2}'`; do ping $i; done;"But given the complexity of my code this usual tactic doesn't work
I would like to keep this simple and if possible use a piped command as opposed to an all out complex method.I have a script that does many things for me, and one of them builds a basic simple system report (I know about lshw, but this is for me to learn as well as be functional)
I would like to add another pipe to remove the"model name:" portion.I do not really want to use the store in a variable first solutions if I can help it.