Sponsored Content
Top Forums Shell Programming and Scripting Need help with SED for replacing an IP Post 302590236 by sags007_99 on Sunday 15th of January 2012 02:28:24 AM
Old 01-15-2012
Need help with SED for replacing an IP

I need some advice to replace 10.183.x.x with 10.174.17.55 in a file containing multiple 10.183.x.x.

Any help would be highly appreciated.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing in SED

I want to change the false in Node 1 to true. How do I do that? <Node1> <Usage>false</Usage> <Url>ABC</Url> </Node1> <Node2> <Usage>false</Usage> <Url>DEF<Url> </Node2> (8 Replies)
Discussion started by: superprogrammer
8 Replies

2. Shell Programming and Scripting

replacing using sed

its again sed question. i have line - sed "s/$old/$new/g" "$f" > $TFILE && mv $TFILE "$f" working well if old="myoldfile" new="mynewfile" but if i want old="/home/shailesh/1test/" new="/home/shailesh/workspace/" it gives error like sed: -e expression #1, char 9: unknown option to... (2 Replies)
Discussion started by: shailesh_arya
2 Replies

3. Shell Programming and Scripting

SED: replacing

Hello, I was looking around, but could not find the answer, so I hope you ppl can help me. I want simply to replace text.:rolleyes: I found out SED would be good for this task.:b: So I tried: :confused: 1.) find text in a line and replace this particular line: for finding... (3 Replies)
Discussion started by: unknown7
3 Replies

4. Shell Programming and Scripting

replacing ' with '' using sed

Hi, I have a text file and I would like to replace all occurrences of single quote ' with two consecutive single quotes '' . I have tried sed s/\'/\'\'/ < Folder/outputFile.txt > Folder/otherFile.txt but this replaces only the first occurrence of ' with ''. I want it to replace all the single... (7 Replies)
Discussion started by: DushyantG
7 Replies

5. Shell Programming and Scripting

sed inside sed for replacing string

My need is : Want to change docBase="/something/something/something" to docBase="/only/this/path/for/all/files" I have some (about 250 files)xml files. In FileOne it contains <Context path="/PPP" displayName="PPP" docBase="/home/me/documents" reloadable="true" crossContext="true">... (1 Reply)
Discussion started by: linuxadmin
1 Replies

6. Shell Programming and Scripting

replacing by sed

hi my input file has got >,,,, or >, or >,,,,,, there are independent number of commas after >.... i want the o/p as > only that is just to remove "," after">" another is: i want to replace the last line of the file and to replace it by "hello"...how to do?... any nice script plz help (2 Replies)
Discussion started by: Indra2011
2 Replies

7. Shell Programming and Scripting

Replacing using sed

hi Guys, I have a rar file which consists of 10 files. each file has a space in its file name. how can i replace all spaces with _ i can replace them using sed but the thing is i need to replace using a script and not command. can anyone help me out??:confused: (2 Replies)
Discussion started by: rajeshb6
2 Replies

8. Shell Programming and Scripting

sed not replacing

Data not replacing using sed,please check below. Replace_value=$$dbconn_target Search_value=$$dbcon_source   sed -e s/\${Search_value}/\${Replace_value}/g intrepid_sps_val.parm (2 Replies)
Discussion started by: katakamvivek
2 Replies

9. UNIX for Dummies Questions & Answers

Replacing digits using sed

How to replace a character followed by a digit using sed? For example lets say I have this file - a1 3242134 54235435 3241235 a2 3214345 45325626 3125435 a3 4236577 54365376 6865678 . . . a3000 5432534 32546546 3254365 I want to replace all... (6 Replies)
Discussion started by: saleheen
6 Replies

10. Shell Programming and Scripting

Not replacing using sed

Hi all, I am trying to change the below word. but the changes is not reflecting in the new file sed -n 's/apple/orange/' filename ---------- Post updated at 12:51 AM ---------- Previous update was at 12:41 AM ---------- I tried this it works perl -pi.bak -e... (9 Replies)
Discussion started by: ramkumar15
9 Replies
Regexp::Common::net(3pm)				User Contributed Perl Documentation				  Regexp::Common::net(3pm)

NAME
Regexp::Common::net -- provide regexes for IPv4 addresses. SYNOPSIS
use Regexp::Common qw /net/; while (<>) { /$RE{net}{IPv4}/ and print "Dotted decimal IP address"; /$RE{net}{IPv4}{hex}/ and print "Dotted hexadecimal IP address"; /$RE{net}{IPv4}{oct}{-sep => ':'}/ and print "Colon separated octal IP address"; /$RE{net}{IPv4}{bin}/ and print "Dotted binary IP address"; /$RE{net}{MAC}/ and print "MAC address"; /$RE{net}{MAC}{oct}{-sep => " "}/ and print "Space separated octal MAC address"; } DESCRIPTION
Please consult the manual of Regexp::Common for a general description of the works of this interface. Do not use this module directly, but load it via Regexp::Common. This modules gives you regular expressions for various style IPv4 and MAC (or ethernet) addresses. $RE{net}{IPv4} Returns a pattern that matches a valid IP address in "dotted decimal". Note that while 318.99.183.11 is not a valid IP address, it does match "/$RE{net}{IPv4}/", but this is because 318.99.183.11 contains a valid IP address, namely 18.99.183.11. To prevent the unwanted matching, one needs to anchor the regexp: "/^$RE{net}{IPv4}$/". For this pattern and the next four, under "-keep" (See Regexp::Common): $1 captures the entire match $2 captures the first component of the address $3 captures the second component of the address $4 captures the third component of the address $5 captures the final component of the address $RE{net}{IPv4}{dec}{-sep} Returns a pattern that matches a valid IP address in "dotted decimal" If "-sep=P" is specified the pattern P is used as the separator. By default P is "qr/[.]/". $RE{net}{IPv4}{hex}{-sep} Returns a pattern that matches a valid IP address in "dotted hexadecimal", with the letters "A" to "F" capitalized. If "-sep=P" is specified the pattern P is used as the separator. By default P is "qr/[.]/". "-sep=""" and "-sep=" "" are useful alternatives. $RE{net}{IPv4}{oct}{-sep} Returns a pattern that matches a valid IP address in "dotted octal" If "-sep=P" is specified the pattern P is used as the separator. By default P is "qr/[.]/". $RE{net}{IPv4}{bin}{-sep} Returns a pattern that matches a valid IP address in "dotted binary" If "-sep=P" is specified the pattern P is used as the separator. By default P is "qr/[.]/". $RE{net}{MAC} Returns a pattern that matches a valid MAC or ethernet address as colon separated hexadecimals. For this pattern, and the next four, under "-keep" (See Regexp::Common): $1 captures the entire match $2 captures the first component of the address $3 captures the second component of the address $4 captures the third component of the address $5 captures the fourth component of the address $6 captures the fifth component of the address $7 captures the sixth and final component of the address This pattern, and the next four, have a "subs" method as well, which will transform a matching MAC address into so called canonical format. Canonical format means that every component of the address will be exactly two hexadecimals (with a leading zero if necessary), and the components will be separated by a colon. The "subs" method will not work for binary MAC addresses if the Perl version predates 5.6.0. $RE{net}{MAC}{dec}{-sep} Returns a pattern that matches a valid MAC address as colon separated decimals. If "-sep=P" is specified the pattern P is used as the separator. By default P is "qr/:/". $RE{net}{MAC}{hex}{-sep} Returns a pattern that matches a valid MAC address as colon separated hexadecimals, with the letters "a" to "f" in lower case. If "-sep=P" is specified the pattern P is used as the separator. By default P is "qr/:/". $RE{net}{MAC}{oct}{-sep} Returns a pattern that matches a valid MAC address as colon separated octals. If "-sep=P" is specified the pattern P is used as the separator. By default P is "qr/:/". $RE{net}{MAC}{bin}{-sep} Returns a pattern that matches a valid MAC address as colon separated binary numbers. If "-sep=P" is specified the pattern P is used as the separator. By default P is "qr/:/". $RE{net}{domain} Returns a pattern to match domains (and hosts) as defined in RFC 1035. Under I{-keep} only the entire domain name is returned. RFC 1035 says that a single space can be a domainname too. So, the pattern returned by $RE{net}{domain} recognizes a single space as well. This is not always what people want. If you want to recognize domainnames, but not a space, you can do one of two things, either use /(?! )$RE{net}{domain}/ or use the "{-nospace}" option (without an argument). REFERENCES
RFC 1035 Mockapetris, P.: DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION. November 1987. SEE ALSO
Regexp::Common for a general description of how to use this interface. AUTHOR
Damian Conway damian@conway.org. MAINTAINANCE
This package is maintained by Abigail (regexp-common@abigail.be). BUGS AND IRRITATIONS
Bound to be plenty. For a start, there are many common regexes missing. Send them in to regexp-common@abigail.be. LICENSE and COPYRIGHT This software is Copyright (c) 2001 - 2009, Damian Conway and Abigail. This module is free software, and maybe used under any of the following licenses: 1) The Perl Artistic License. See the file COPYRIGHT.AL. 2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2. 3) The BSD Licence. See the file COPYRIGHT.BSD. 4) The MIT Licence. See the file COPYRIGHT.MIT. perl v5.14.2 2011-12-11 Regexp::Common::net(3pm)
All times are GMT -4. The time now is 09:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy