8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Gurus,
I have requirement need to sum the value, the logic is if the value is negative then time -1, I tried below two ways. one is failed, another one doesn't work.
awk -F"," '{if($8< 0 $8*-1 else $8) sum+=$8}{print sum, $8} END{printf("%.2f\n",sum)}'
awk -F","... (4 Replies)
Discussion started by: ken6503
4 Replies
2. Shell Programming and Scripting
Can anyone please assist me?
Please find the attached input and output file for ur reference.
a)Incase if i get negative value (ex:-000100) in the 11th column then i have to convert the value to 0000000(7 zeros-length is 7) and then
print the entire record.
b)Incase if there is no... (2 Replies)
Discussion started by: vinus
2 Replies
3. Shell Programming and Scripting
Hi All,
i have 20 Obligors when ever i dont find all of them on particular row/line from each in put i need to print it in different file.
using below command but it is not working please help at earliest.
Steps:
set -A FILENAME $( cat... (10 Replies)
Discussion started by: rajubollas
10 Replies
4. IP Networking
Hi,
I am trying to add a static route in one of 3 server (S3) so that I can access the main application server (S1). But problem is, the server (S3) where I am trying to add static route is connected with another server (S2) which is in same private network of application server (S1).
I have... (9 Replies)
Discussion started by: ImranBD
9 Replies
5. Shell Programming and Scripting
Hi, i need help on replacing negative values in a column with 0. any quick fix on this? thanks much. for instance,
input:
1
2.3
-0.4
-25
12
13
45
-12
desired output
1
2.3
0
0
12
13
45 (4 Replies)
Discussion started by: ida1215
4 Replies
6. Shell Programming and Scripting
Hello,
I have a list like this :
1
2
-4
0
-3
-7
5
6 etc.
Is there a way to remove all the positive values and print only the negative values, without using grep, sed or awk?
Thanks,
Prasanna (4 Replies)
Discussion started by: prasanna1157
4 Replies
7. IP Networking
I am looking for advice on a router. I am new to Linux and am trying to use Limewire and Ktorent and can make no connection. Limewire indicates I have a firewall. I have a Linksys router WRK54G and my guess is that is the problem. I have spent hours upon hours trying to get it to work using info... (0 Replies)
Discussion started by: Paul K
0 Replies
8. SCO
Hello.
I just installed a SCO Openserver 6 box and it's suckin' mud.
sar -v (see below) shows something that has me quite concerned... after time, it shows that the number of inodes being used as a negative value. When this happens, the server runs extremely slow until I reboot. The server... (0 Replies)
Discussion started by: debtman3535
0 Replies
GETPEERNAME(2) Linux Programmer's Manual GETPEERNAME(2)
NAME
getpeername - get name of connected peer socket
SYNOPSIS
#include <sys/socket.h>
int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
DESCRIPTION
getpeername() returns the address of the peer connected to the socket sockfd, in the buffer pointed to by addr. The addrlen argument
should be initialized to indicate the amount of space pointed to by addr. On return it contains the actual size of the name returned (in
bytes). The name is truncated if the buffer provided is too small.
The returned address is truncated if the buffer provided is too small; in this case, addrlen will return a value greater than was supplied
to the call.
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
EBADF The argument sockfd is not a valid descriptor.
EFAULT The addr argument points to memory not in a valid part of the process address space.
EINVAL addrlen is invalid (e.g., is negative).
ENOBUFS
Insufficient resources were available in the system to perform the operation.
ENOTCONN
The socket is not connected.
ENOTSOCK
The argument sockfd is a file, not a socket.
CONFORMING TO
SVr4, 4.4BSD (the getpeername() function call first appeared in 4.2BSD), POSIX.1-2001.
NOTES
The third argument of getpeername() is in reality an int * (and this is what 4.x BSD and libc4 and libc5 have). Some POSIX confusion
resulted in the present socklen_t, also used by glibc. See also accept(2).
For stream sockets, once a connect(2) has been performed, either socket can call getpeername() to obtain the address of the peer socket.
On the other hand, datagram sockets are connectionless. Calling connect(2) on a datagram socket merely sets the peer address for outgoing
datagrams sent with write(2) or recv(2). The caller of connect(2) can use getpeername() to obtain the peer address that it earlier set for
the socket. However, the peer socket is unaware of this information, and calling getpeername() on the peer socket will return no useful
information (unless a connect(2) call was also executed on the peer). Note also that the receiver of a datagram can obtain the address of
the sender when using recvfrom(2).
SEE ALSO
accept(2), bind(2), getsockname(2), ip(7), socket(7), unix(7)
COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2013-02-12 GETPEERNAME(2)