06-12-2014
In addition, I would consider using $2!=pid, since at some point, the numbering of processes may start anew, so an earlier process is not always guaranteed to have a lower number..
This User Gave Thanks to Scrutinizer For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi Friends
How do I do two things from one if statement inside awk? I want to run a script and create a new file from the same condition.
awk '{ if ($2 == ""){print " "|"cd /local/test; ./script.ksh"}{cat > ran_true.txt}}' $IN_FILE
Bolded are the two things I want to be done.
Thanks (1 Reply)
Discussion started by: UNovIX
1 Replies
2. Shell Programming and Scripting
hi all,
i have two files
1) a.txt
one
two
three
2)
abc "one" = 10
pqr "three" = 20
345 "two" = 0
this is what i want in third file (3 Replies)
Discussion started by: shishirkotkar
3 Replies
3. Shell Programming and Scripting
Having a little trouble with awk and an if statement. I have a test setup which I am trying to only print the records which start with the month 03. Everything I tried, prints everything, even the 02 month
03/23/2010 12:47:51
ga2828
SUBMITTED FROM URL: test123.cgi
show port count
... (2 Replies)
Discussion started by: numele
2 Replies
4. Shell Programming and Scripting
Hello all,
I'm very new to this (<5hrs!) please bear with me. My file looks like this
386259.448541 417069.155 154935.157 186.206 162 1 1 8
386259.448551 417068.53 154935.04 186.144 156 1 1 8
386259.448561 417067.911 154934.926 186.175 164 1 1 8
386259.450337 417086.643 154946.483 894.671... (4 Replies)
Discussion started by: rebeccab37
4 Replies
5. Shell Programming and Scripting
Hi,
I have a data file which contains record count.
So doing wc -l rightfit_balancing_count.dat | awk '{print $1}'] gives me the record count stored in the file.
Now, i want to send a mail from UNIX, if the record count is equal to 0,otherwise it should do nothing.
Any help... (2 Replies)
Discussion started by: Shell_Learner
2 Replies
6. Shell Programming and Scripting
hi,
I have a l-column file of more than 10,000 lines with interspersed negative values. What I want to do is add a fixed number (360) everytime a negative value is encountered while leaving the positive ones as is. I need something that will read every line of the file and do the calculation... (3 Replies)
Discussion started by: ida1215
3 Replies
7. Shell Programming and Scripting
Hi
I have a file with
test test2 1000000657373
test1 test3 1000003849450
test2 test4 test5 100000837474
I cat the file and pipe it to an awk statement like so
cat /tmp/file |awk '{if ($3 ~ "^*$" && $3 > 1024000000) print "/vol/"$1"/"$2;else if ($4 ~ "^*$" && $4 > 1024000000) print... (15 Replies)
Discussion started by: bombcan
15 Replies
8. Shell Programming and Scripting
I am using awk as part of and if then else statement. I am trying to have the user enter a gene name and then a variant or variants and have a specific transcript assigned to the variants depending on the gene. Below is my code but the if then else statement is wrong. Basically, the gene name... (2 Replies)
Discussion started by: cmccabe
2 Replies
9. Shell Programming and Scripting
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
10. Shell Programming and Scripting
There has to be a way to do this with awk or maybe I'm just focusing on the wrong tool and making this harder than it needs to be.
I'm trying to do a file field lookup/join at a very large scale but the output changes has to change dramatically. I have an input file to do a field lookup from and... (3 Replies)
Discussion started by: brettcasper
3 Replies
KILL(2) System Calls Manual KILL(2)
NAME
kill - send signal to a process
SYNOPSIS
kill(pid, sig)
int pid, sig;
DESCRIPTION
Kill sends the signal sig to a process, specified by the process number pid. Sig may be one of the signals specified in sigvec(2), or it
may be 0, in which case error checking is performed but no signal is actually sent. This can be used to check the validity of pid.
The sending and receiving processes must have the same effective user ID, otherwise this call is restricted to the super-user. A single
exception is the signal SIGCONT, which may always be sent to any descendant of the current process.
If the process number is 0, the signal is sent to all processes in the sender's process group; this is a variant of killpg(2).
If the process number is -1 and the user is the super-user, the signal is broadcast universally except to system processes and the process
sending the signal. If the process number is -1 and the user is not the super-user, the signal is broadcast universally to all processes
with the same uid as the user except the process sending the signal. No error is returned if any process could be signaled.
For compatibility with System V, if the process number is negative but not -1, the signal is sent to all processes whose process group ID
is equal to the absolute value of the process number. This is a variant of killpg(2).
Processes may send signals to themselves.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
Kill will fail and no signal will be sent if any of the following occur:
[EINVAL] Sig is not a valid signal number.
[ESRCH] No process can be found corresponding to that specified by pid.
[ESRCH] The process id was given as 0 but the sending process does not have a process group.
[EPERM] The sending process is not the super-user and its effective user id does not match the effective user-id of the receiving
process. When signaling a process group, this error was returned if any members of the group could not be signaled.
SEE ALSO
getpid(2), getpgrp(2), killpg(2), sigvec(2)
4th Berkeley Distribution May 14, 1986 KILL(2)