10-01-2008
Thanks for the above posts but
The number of files are not fixed... also I need a shell script solution n not have python.
also ...the script can have perl commands in it.
Please help
10 More Discussions You Might Find Interesting
1. IP Networking
hither!
whatz the command to find which process is using a specific port number? for example, port 8082? (3 Replies)
Discussion started by: darkcastle
3 Replies
2. UNIX for Dummies Questions & Answers
Newby here.....
Is there any way of doing a find & replace within a huge file other than using something like : " vi - FileForReplacing < /u1/excel/consultants "
contents of consultants file looks like
:1,$s/0000031/CON/g
:1,$s/0001032/JONES/g
:1,$s/0001355/SMITH/g... (3 Replies)
Discussion started by: Gerry405
3 Replies
3. Shell Programming and Scripting
I have some ASCII files containing numerous numbers. What I'd like to do is replace all numbers greater than 0 with 1.
Examples of the numbers include: - 000011 and 000042
Thanks (4 Replies)
Discussion started by: vrms
4 Replies
4. Solaris
Hi all ,
I want know the port no on which a particular application is running.
How to find that?
Thanks in anticipation (11 Replies)
Discussion started by: kumarmani
11 Replies
5. Shell Programming and Scripting
Hi
Im trying to replace http port value.However for some reason its not working.Can you guys take a look and hit me with suggestions please.Your help is much appreciated.
echo "Enter Value"
read ans
sed -i "s/http-port = 80 /http-port = $ans/g" demo
Note:demo is the filename
... (6 Replies)
Discussion started by: coolkid
6 Replies
6. Shell Programming and Scripting
Hi,
I have lines in some files that look exactly as below, and the line numbers they occur in are always the same. (Lines 136-139)
W 0.00000000 0.00000000 2.00000000
W 0.50000000 0.50000000 2.50000000
W 0.00000000 0.00000000 3.00000000
W 0.50000000 0.50000000 3.50000000
I'd like to... (0 Replies)
Discussion started by: bluesmodular
0 Replies
7. Shell Programming and Scripting
Hi,
I would like to do a scripting for finding the links based on the name I have and replace the links with the new name. General find command lists everything for that links ( means all the sub-sirs and all the files), i need only the main link and replace.
Can you anyone give me some... (1 Reply)
Discussion started by: rrb2009
1 Replies
8. Shell Programming and Scripting
hi i have two files
one of the form
1 2
2 45
3 56
4 98
5 6598
6 98
7 10
8 0
9 15
10 56
This file's significance is that it maps the number in first column to that of the number in second column
The other file is of the form
1
2 (1 Reply)
Discussion started by: vaibhavkorde
1 Replies
9. Shell Programming and Scripting
Hi Guys,
I saw this line of code in a script
sftp username@hostname#2200
get file
and the script never asked for password. Can you please explain on this?:confused: (9 Replies)
Discussion started by: PikK45
9 Replies
10. Shell Programming and Scripting
Hi, I need to replace a character between two numbers (specifically a - to a _). The problem is that they can be *any* numbers. So, I need a one liner to turn a file like this:
1-2
3-4
55-66
4323-12312893
into the following
1_2
3_4
55_66
4323_12312893
Any help would be appreciated! (5 Replies)
Discussion started by: mikey11415
5 Replies
LEARN ABOUT BSD
getservbyname
GETSERVENT(3N) GETSERVENT(3N)
NAME
getservent, getservbyport, getservbyname, setservent, endservent - get service entry
SYNOPSIS
#include <netdb.h>
struct servent *getservent()
struct servent *getservbyname(name, proto)
char *name, *proto;
struct servent *getservbyport(port, proto)
int port; char *proto;
setservent(stayopen)
int stayopen
endservent()
DESCRIPTION
Getservent, getservbyname, and getservbyport each return a pointer to an object with the following structure containing the broken-out
fields of a line in the network services data base, /etc/services.
struct servent {
char *s_name; /* official name of service */
char **s_aliases; /* alias list */
int s_port; /* port service resides at */
char *s_proto; /* protocol to use */
};
The members of this structure are:
s_name The official name of the service.
s_aliases A zero terminated list of alternate names for the service.
s_port The port number at which the service resides. Port numbers are returned in network byte order.
s_proto The name of the protocol to use when contacting the service.
Getservent reads the next line of the file, opening the file if necessary.
Setservent opens and rewinds the file. If the stayopen flag is non-zero, the net data base will not be closed after each call to get-
servbyname or .IR getservbyport .
Endservent closes the file.
Getservbyname and getservbyport sequentially search from the beginning of the file until a matching protocol name or port number is found,
or until EOF is encountered. If a protocol name is also supplied (non-NULL), searches must also match the protocol.
FILES
/etc/services
SEE ALSO
getprotoent(3N), services(5)
DIAGNOSTICS
Null pointer(0) returned on EOF or error.
BUGS
All information is contained in a static area so it must be copied if it is to be saved. Expecting port numbers to fit in a 32 bit quan-
tity is probably naive.
4.2 Berkeley Distribution May 19, 1986 GETSERVENT(3N)