10-17-2008
using sed to get IP-address
Hi folks!
I need to get an ip address of a string that has the same apperance in every case. The string looks like this:
$node="node_ip:109.50.89.211; node:j20"
What I want to do is to extract the IP-address from this string using regular expression. Since I havn't worked much with regexp's I dont really know how to tackle this.
However, if one is able to extract ip from the pattern:
[0-9]{1-3 digits}.[0-9]{1-3 digits}.[0-9]{1-3 digits}.[0-9]{1-3 digits}
somehow...
Does any of you know how to do this?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Trying to write a sed command that applies multiple replacements to a specific address. Need a second pair of eyes I guess cause my syntax appears to be correct (obviously not though) I am getting an error. Any Help would be appreciated! Thanks in advance.
sed -f foo envOracle
sed: Function... (2 Replies)
Discussion started by: google
2 Replies
2. UNIX for Dummies Questions & Answers
I'm attempting to append a line after a specific address with sed. If I type in the address eg.3 then it will append after the third line. I can't get it to work with a variable though. Does anyone know how to do it please?
sed '/3/a\
text' filename :)
sed '/\$address/a\
text' filename... (8 Replies)
Discussion started by: Sniper Pixie
8 Replies
3. UNIX for Dummies Questions & Answers
I would like to grab only designates and the IP address next to it. I can also live with client-ip=xx.xx.xx.xx
Any help is much appreciated.
line to grep or sed:
Received-SPF: pass (google.com: domain of support@uhb-hosting.de designates 80.67.28.12 as permitted sender)... (7 Replies)
Discussion started by: tigta09
7 Replies
4. Shell Programming and Scripting
Hi All,
how to get solaris box local ip addresss in variable, using sed or awk utlities.
Thanks,
Mani Muthu (7 Replies)
Discussion started by: k_manimuthu
7 Replies
5. Shell Programming and Scripting
Hi Folks,
In my program, I have a variable which consists of multiple lines. i need to use each line as an input. My intention is to extract the email address of the user in each line and use it to process further.
The email address could be anywhere in the whole line. But there will be only... (5 Replies)
Discussion started by: ragz_82
5 Replies
6. Shell Programming and Scripting
Hi,
In a file, I have several time
<IP>232.0.1.164</IP>
...
<IP>232.0.1.135</IP>
I need to replace all the random IP addresses , by 239.0.0.1 and 239.0.0.2 , alternatively.
I try this
grep "<IP>" tsp.xml | awk '{if(NR % 2)print $0}' | cut -d"<" -f2 | cut -d">" -f2 ... (3 Replies)
Discussion started by: FredMo
3 Replies
7. Solaris
in Solaris 10 I am able to run:
find . -type f -name "copy*" exec grep example.com {} \;
and I get results.
but when I try to find and sed:
find . -type f -name "copy*" exec sed -e 's/user@example\.com/user2@example\.com' {} \;
the command executes correctly but doesn't change... (6 Replies)
Discussion started by: os2mac
6 Replies
8. Shell Programming and Scripting
Hi,
I have to modify the 2nd and 3rd octet of the IP address through awk/sed.
For Example:
Given IP is : 10.205.22.254, it should be modified as 10.105.100.254 through awk/sed.
Kindly help me on this and let me know if you have any questions.
Thanks in advances. (2 Replies)
Discussion started by: kumarbka
2 Replies
9. Shell Programming and Scripting
I am trying to grep for a particular text (Do action on cell BL330) in a text file(sample.gz) which is searched in the content filtered by date+timestamp (2016-09-14 01:09:56,796 to 2016-09-15 04:10:29,719) on a remote machine and finally write the output into a output file on a local machine.
... (23 Replies)
Discussion started by: rbadveti
23 Replies
10. UNIX for Beginners Questions & Answers
I am trying to add word in last of particular line.
the same command syntex is running on prompt. but in bash script give error."sed: -e expression #1, char 20: unterminated address regex"
Please help.
for i in `cat servername`;
do
ssh -q -t root@$i sed -i '/simple_allow_groups =/s/$/,... (4 Replies)
Discussion started by: yash_message
4 Replies
LEARN ABOUT ULTRIX
addnode
addnode(8) System Manager's Manual addnode(8)
Name
addnode - add or change an entry in the nodes database
Syntax
/etc/addnode node [ options ]
Description
The command adds a new node entry to the nodes database or modifies an existing entry. The nodes database is the one used by DECnet. The
command defines the information that is necessary for your ULTRIX node to be capable of down-line loading and up-line dumping a particular
target node. The node address is the address of the target node. If the target node is a DECnet node, then the node address is mandatory
and the node name is optional. However, if the target node is a non-DECnet node, for example, a terminal server, you should specify only
the node name and omit the node address.
If you do not specify an absolute pathname for secondary load, tertiary load, system load, diagnostic load, or dump file, the default path,
is used during the load or dump process.
A node address is a decimal integer in the range of 1 to 1023 for single area networks, or has the format a.n for multiarea networks, where
a is the network area number (a decimal integer in the range of 1 to 63) and n is the node number (a decimal integer in the range of 1 to
1023).
The node name is the node name of the target node.
If the target node is a DECnet node, the node name is optional. However, if the target node is a non-DECnet node, for example, a terminal
server, the node name is mandatory (and the node address should be ignored).
A node name can be from 1 to 6 alphanumeric characters, including at least 1 alphabetic character.
Options
-A Uses the specified host address (next argument) as that of the target node.
-D Creates an up-line memory dump of the target node in the specified file (next argument).
-N Uses the specified name (next argument) as that of the target node.
-c Uses the specified service and device number (UBA-n or QNA-n) as the circuit to the target node.
-d Sends the specified diagnostic load image (next argument) to the target node.
-h Uses the specified address (next argument) as the Ethernet address of the target node.
-l Sends the specified system load image (next argument) to the target node.
-p Uses the specified service and password (next arguments) in accessing the target node.
-s Sends the specified secondary load file (next argument) to the target node.
-t Sends the specified tertiary load file (next argument) to the target node.
Examples
% /etc/addnode mynode -h aa-00-03-00-01-19 <RET>
-s /usr/download/secondary <RET>
-t /usr/download/tertiary <RET>
-l system <RET>
This command adds the non-DECnet, node mynode, to the nodes database, which has the Ethernet physical address aa-00-03-00-01-19. This com-
mand also specifies the file names for the secondary loader, the tertiary loader, and the system loader. Note that a path name is not
specified for the system loader; consequently, the loader uses the default path when searching for that file.
# /etc/addnode 44.71 -h aa-00-03-00-01-20 <RET>
This command adds the DECnet node 44.71 to the nodes database, which has the Ethernet physical address aa-00-03-00-01-20.
See Also
ccr(8), getnode(8), load(8), mop_mom(8), remnode(8), trigger(8)
addnode(8)