05-05-2006
Quote:
Originally Posted by sendhilmani123
Hi,
The script works fine when there are no "|" symbols in the file. But even if one of them is present then it still says that the format is ok, which is not the exact way.
ie....
I have inputs like this.
Mani|123 prof
This kind of input also is accepted by the script. But it should not accept. It should accept only if all the three field are seperated by "|".
Thanks in advance
Does the awk statement work well ?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I've been assigned the task of modifying a script which reads in names of tables from a list file, exports a 30 days worth of data from these tables, then deletes the table. The list file will now contain a table name and a number next to it indicating how many days to archive. I need... (1 Reply)
Discussion started by: MadHatter
1 Replies
2. Shell Programming and Scripting
Hi,
I have a shell script that has to taken inputs from a file say "Inputs". Now I take 2 inputs at a time. Suppose the Inputs file contains numbers like
2
3
4
5
Now I have a written a script for adding 2 numbers. When I run the script for first time 2 and 3 must be the inputs. When i run the... (4 Replies)
Discussion started by: sendhil
4 Replies
3. Shell Programming and Scripting
i have an external device sending serial messages i want to connect this device to a serial port in my sun blade box and record those messages to a file, how can i read the serial port and write it to file?
Thanks (4 Replies)
Discussion started by: guilartec
4 Replies
4. Shell Programming and Scripting
Hi,
I have a file called inputs. Now that file has the values like this:
1 2 3
Now In my script called 'get.sh' I do this :
exec < inputs
read a b c d
Now I know that there will not be any value in d. How can I check it. I need the exact condition for checking whether the variable has... (1 Reply)
Discussion started by: sendhilmani123
1 Replies
5. Shell Programming and Scripting
Hi,
This with reference to my earlier thread.
I have file called input that has 2 values. Now I have to check whether the 2 fileds are seperated by a "|" or not. I am not able to do this with the following script.
while read line
do
first=`echo $line | cut -f1 -d'|'`
... (8 Replies)
Discussion started by: sendhilmani123
8 Replies
6. Shell Programming and Scripting
Hello;
Please I need to read inputs from a file change 1 or 2 things the output to another file. (1 Reply)
Discussion started by: jimoney
1 Replies
7. Shell Programming and Scripting
Hello,
I had written a shell script that accepts input file as cmd line argument and process this file.
if ; then
if ; then
. $1
LOGFILE="$LOG_FILE/MIG_BIOS.log";
get_input_file
else
ERROR_CODE=MSCRM0005_003
error "$ERROR_CODE : Input file $1 is not available";
exit... (3 Replies)
Discussion started by: Poonamol
3 Replies
8. Shell Programming and Scripting
I want a script that will prompt a user to enter 10 numbers and out put them into a file. This what I have so far, but isn't working. I'm guessing it's something easy I'm not seeing. Thanks for any help.
#!/usr/bin/ksh
echo "Enter 10 numbers"
for i in 1 2 3 4 5 6 7 8 9 10
do
read .... ... (8 Replies)
Discussion started by: AxlVanDamme
8 Replies
9. Shell Programming and Scripting
Hi,
Am trying to store the user inputs into a file, but the below code will store only the first line of the values. I need to store all the user input values which may contain one or more lines. Thanks in advance.
echo "please enter file names";
read name;
echo $name>/tmp/test (11 Replies)
Discussion started by: rogerben
11 Replies
10. Shell Programming and Scripting
Hi ,
I am not able figure out how to use expect tool to send input to this prompt of format
Searching for disks...done
selecting c0t3d0
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition... (3 Replies)
Discussion started by: chidori
3 Replies
LEARN ABOUT OPENSOLARIS
accept
accept(3SOCKET) Sockets Library Functions accept(3SOCKET)
NAME
accept - accept a connection on a socket
SYNOPSIS
cc [ flag ... ] file ... -lsocket -lnsl [ library ... ]
#include <sys/types.h>
#include <sys/socket.h>
int accept(int s, struct sockaddr *addr, socklen_t *addrlen);
DESCRIPTION
The argument s is a socket that has been created with socket(3SOCKET) and bound to an address with bind(3SOCKET), and that is listening for
connections after a call to listen(3SOCKET). The accept() function extracts the first connection on the queue of pending connections, cre-
ates a new socket with the properties of s, and allocates a new file descriptor, ns, for the socket. If no pending connections are present
on the queue and the socket is not marked as non-blocking, accept() blocks the caller until a connection is present. If the socket is
marked as non-blocking and no pending connections are present on the queue, accept() returns an error as described below. The accept()
function uses the netconfig(4) file to determine the STREAMS device file name associated with s. This is the device on which the connect
indication will be accepted. The accepted socket, ns, is used to read and write data to and from the socket that connected to ns. It is not
used to accept more connections. The original socket (s) remains open for accepting further connections.
The argument addr is a result parameter that is filled in with the address of the connecting entity as it is known to the communications
layer. The exact format of the addr parameter is determined by the domain in which the communication occurs.
The argument addrlen is a value-result parameter. Initially, it contains the amount of space pointed to by addr; on return it contains the
length in bytes of the address returned.
The accept() function is used with connection-based socket types, currently with SOCK_STREAM.
It is possible to select(3C) or poll(2) a socket for the purpose of an accept() by selecting or polling it for a read. However, this will
only indicate when a connect indication is pending; it is still necessary to call accept().
RETURN VALUES
The accept() function returns -1 on error. If it succeeds, it returns a non-negative integer that is a descriptor for the accepted socket.
ERRORS
accept() will fail if:
EBADF The descriptor is invalid.
ECONNABORTED The remote side aborted the connection before the accept() operation completed.
EFAULT The addr parameter or the addrlen parameter is invalid.
EINTR The accept() attempt was interrupted by the delivery of a signal.
EMFILE The per-process descriptor table is full.
ENODEV The protocol family and type corresponding to s could not be found in the netconfig file.
ENOMEM There was insufficient user memory available to complete the operation.
ENOSR There were insufficient STREAMS resources available to complete the operation.
ENOTSOCK The descriptor does not reference a socket.
EOPNOTSUPP The referenced socket is not of type SOCK_STREAM.
EPROTO A protocol error has occurred; for example, the STREAMS protocol stack has not been initialized or the connection has
already been released.
EWOULDBLOCK The socket is marked as non-blocking and no connections are present to be accepted.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO
poll(2), bind(3SOCKET), connect(3SOCKET), listen(3SOCKET), select(3C), socket.h(3HEAD), socket(3SOCKET), netconfig(4), attributes(5)
SunOS 5.11 24 Jan 2002 accept(3SOCKET)