Programming :: How To Handle Division By Zero In Awk
May 29, 2011Sometimes the variables will be 0 and sometimes not, and of course the output may also be 0%...What is the best method to handle division by zero errors in awk.
View 2 RepliesSometimes the variables will be 0 and sometimes not, and of course the output may also be 0%...What is the best method to handle division by zero errors in awk.
View 2 Repliesi getting following error message plz help me to solve
[root@localhost a]# awk -f dream2.awk simple.tr >simple1.tr
awk: dream2.awk:29: (FILENAME=simple.tr FNR=53107) fatal: division by zero attempted
[root@localhost a]#
I would like to make program that reads a *.TXT file and searches for last line and constatly refreshing the search. So last line would look something like this:Mike Had A 100.0 Pound Shark.So there are multplie category of "fish"(Shark, Dolphin, etc.) and each of them have allowed weight (ie. minimum 70.0 Pound Shark, 50.0 Pound Dolphin). If in the found sentence Shark or Dolphin doesn't meet requierments than program named False.exe should be started. I dont know how to make it my self so any help is much appreciated. My knowledge on programming is very low but I'm opend for learning.
View 1 Replies View RelatedI want to write simple firefox extension / script or anything to change URLs from HTTP to HTTPS for selected websites (e.g. facebook). That thing is actually bypassing some security checks in my network.
Can anyone tell me how to proceed? I can deal with language as far its C++ or Python (something else would just take more time that's all )
I'm new to php and need some pointers to worth while documentation 'cause I'm getting nowhere I want to make a simple html form that allows me to submit a csv file so that I can work on it.The problem seems to be that if the file is not in the root of the (web) application it won't work.The form doesn't seem to send the path with it so I am unable to (1) know where the file is, I just get the name of the file and (2) I couldn't access the file anyway as it's outside of the apache environment.Is there a way to up the file to memory? How would you do this
View 3 Replies View RelatedI need to make a daemon which listens to port 81 for messages like [URL] So far I made a daemon which serves as a simple stream server: I set up a socket to listen to a non-reserved port (like 9999), but I don't know how to read the query strings.
Linux distro: Kubuntu 9.04
Language: C
I have a file with 200 000 lines and I want to append the fields of each line based on matching first field. The resulting file should have 70 000 columns but has "only" 18 000. The command I'm using is working perfectly with a smaller file, wich lead to 14 000 columns. Could there be a limit in number of fields that awk can handle ? Here's my awk command :
Code:
awk -F, 'END { for (k in _) print _[k] } { _[$1] = $1 in _ ? _[$1] FS $4 : $1","$4 } ' file > out
Also, this command writes ^M (windows line break) after each columns. Removing them is easy but where do they come from ? Working on Ubuntu 10.10
I have a script that that is supposed to send me an e-mail when a host is not responding to ping:
The script works fine when I execute it directly but when cron executes it, the ping error is never picked up by the script so the if statement is ignored.
I'm learning Signals, and I have a question:
Is possible to make a handle when I press any of the keyboard buttons?
The SIGINT handles the Ctrl-C combination, but I want to handle if any keyboard button was pressed.
*I'm using Ubuntu 10.10
My issue is I can't handle the files with spaces in their name, I've donde the below script to print each file found inside folder and subbfolders with "find".
I would like to "ls" to each file found with its complete path and with its basename too.
Code:
files=$(find . -type f)
for each in "$files"
do
ls -l "$each" # 1rst option I've tried to list with full path
ls -l "$(/bin/echo "$each")" # 2nd option I've tried to list with full path
ls -l "$(/bin/echo $(basename "$each"))" # 1nd option I've tried to list with it basename
[Code].....
How can I list "ls -l" in both cases (with full path and with basename) when there are files with spaces in their name?
Need to handle SIGSEGV error when pbuf size is less than size. inside lib.:
for (i = 0; i < size; i++)
pbuf[i] = i;
A question of ODBC correctness - maybe someone knows.
Code:
// statement handle is sth, connection handle is dbch
SQLExecDirect(sth, ...);
// ... bind var, fetch results ...
SQLFreeHandle(SQL_HANDLE_STMT, sth); // free statement handle
SQLEndTran(SQLHANDLE_DBC, dbch, SQL_COMMIT);
(error checking removed for clarity).
To my mind this seems wrong - surely the statement handle should be free'd only after the commit is done? Or maybe not. I theorize about the ODBC library like this: a whole set of statements can be created, run, executed in one transaction (which is held at the connection level), and only after all that is a commit/rollback done. So maybe it's OK. Even so it still feels weird. What is written above works, but there are rare and very difficult to replicate problems with this code, and I wonder if a premature free might be the cause...?
how to handle non argument error while adding two alphabets using 'expr' (not bc).
View 1 Replies View RelatedI have made two source files named as sum.c and average.cI have included sum.c in average.c
both files in Documents directory.when i compile average.ot followingerror"average.c:4:22: fatal error: sum.c: No such file or directorycompilation terminated.How to solve this issue?I have tried to copy sum.c to usrinclude folder but unable to copy
I've written a simple server in linux used fork to create a FIFO pipe.The server create two FIFO pipe.One for server read data from client and write data to client.Then another pipe for client read data from server and write data to server.When the server read data from a client used server-pipe and then write data to client.But ,if the client no read open the pipe,the server side write will be crashed because of a broken-pipe SIGPIPE. How to check whether the read side is opened?Or,how to catch the SIGPIPE,and then my server will still execute on,not crashed!!
View 5 Replies View RelatedI have a function in perl which I want to use trap all errors a script ocurs which the script does not explicitly handle. These errors are then logged to various places. So I tried to use a eval block but the problem I have is sometimes if you put a die statement in the evaled script it doesn't get handled. What I have so far is:
[Code]....
Logical Memory Space of 4GB is divided in to 3GB User Space and 1GB Kernel Space. Always. Correct?
1. How can we change it? (just changing value of PAGE_OFFSET is okay?)
2. If system have only 256MB of memory (embedded system) and suppose Kernel Modules eat away all the memory during boot. User space will be left will no memory. Is this case possible?
being a btech student we have an asignment on call centre management.i have the source code and know how to do it in windows,but i prefer to do it in linux tats in debian5.can you tell me how to handle sql database in debian5?also after debian installation i cant login as a root but can acess root terminal from home.how can i solve this?is it because of wrong partitioning during installation?
View 7 Replies View RelatedThere is not a lot of info on that command, I didn't find a manpage nor a info and not more than examples on the web. Is there any tutorial or info on internet?
View 2 Replies View RelatedI've been trying to understand issues that occur during a uClinux distribution build (so I can include such issues in a module I'm writing for students). My process has been to work through errors that occur due to missing packages, then remove the distribution and build it again to uncover what happens.One thing I notice is different sets of warnings within each iteration of making a new build. From the document here (URl...it states, "A typical warning involves a variable being used before its value has been set."
So my question: is there a way to verify that the issue throwing the warning has been resolved by the end of the make build?And, is running make build again an option or could this cause problems within the build directories or image?
i have files more than 2G on my pc. some programs like wireshake can't habdle them. is there any chance to configure my OS to handle these files.i am using Ubuntu 9.10.
View 1 Replies View RelatedI am playing GNUchess and my cpu can't handle it. I read on the web that GNUchess always uses 100% of cpu.
I wonder if there is a solution to this, like setting the cpu freq lower or something. Please help.
I own a Intel(R) Pentium(R) Dual CPU T2370 @ 1.73GHz
Is/are there a tutorial(s) for KDE 4 maybe written for OpenSuse? I'd especially like to get a better handle on having different activities on different desktops. I've seen one for PCLinuxOS that refers to something called ZUI and zoom in & out but am having trouble relating.
View 3 Replies View RelatedI'm trying to set up a virtual web server using virtual pc and a net-tuts how to. So I went ahead and downloaded Ubuntu 9.10 Server Edition, but it only comes in 64-bit, and vpc doesn't handle 64-bit. How I can get around this? I have a machine that I could set up as a server, but that is also only 32-bit.
View 6 Replies View RelatedI was running Ubuntu fine with 2 monitors, I added another video card and a 3rd monitor, and now it only shows up on one. All 3 work fine when I boot to Windows 7.
Can Ubuntu do all 3 or not?
I have seen there are some tricks to handle transparents switches using Nagios. Does anybody know if it is possible to handle unmanaged switches connected in daisy chain?In my network I have some devices connected in this way [switch]--[dev_1]--[dev_2]--[dev_3]
where "switch" is a managed switch" and dev_i is a device with an unmanaged switch inside (no snmp available). All the devices have an IP address. Is it possible to get the network topology with Nagios?
I am trying to use telnet from linux to connect to the port specified by me and trying to handle control C. But once Ctrl C is pressed the output on the client side stops showing. The server sends data but client doesnt print the same.
View 2 Replies View RelatedWe have setup a High Available Cluster on two RHEL 5.4 machines with Redhat Cluster Suite (RHCS) having following configuration.
1. Both machines have Mysql server, Apache web server and Zabbix server.
2. Mysql database and web pages reside in SAN.
3. Active machine holds virtual IP and mounted shared disk.
4. We have also included a script in RHCS which takes care of starting Mysql, Apache and zabbix server on the machine which turns active when cluster switches over.
The above configuration holds good if Active machine goes down as a result of hardware failure or Reboot. What if, If any one service say Apache/Mysql/zabbix running on active hangs or become unresponsive.How can we handle this scenario ? Please advice.
Where to get a plugin to handle *.zip files
View 2 Replies View RelatedOn a small Linux appliance using Busybox to provide the usual suspects, I'd like to create an alias "ll" that would translate to "ls -al" like I'm used to. Apparently, "alias" is not part of Busybox:
Code:
> echo $SHELL
/bin/sh
> ls -al /sbin/sh*
lrwxrwxrwx 1 1000 1000
7 Jan 1 2007 /sbin/sh -> busybox
> alias ll='ls -al'
alias: not found