LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-26-2010, 02:37 AM   #16
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191

Quote:
that didn't work crts!
So you got an error?
 
Old 10-26-2010, 03:16 AM   #17
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by eliote View Post
that didn't work crts!
maybe you could help me more interactively...
have you got yahoo ID?!
it works if you enter, e.g.
192.168.1.10/24
or
192.168.1.10/35
at the read prompt.
BTW, it is the slash that was messing up the previous sed statement. That is why we changed the delimiter.
If you want to add /24 statically then try
Code:
sed -ri "/^ip address=/ s|[0-9].*[0-9]|$newip/24|" file
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting blank lines in text file David the H. Linux - General 5 11-24-2007 03:34 PM
Inserting file contents into Sed Command ewingtux Programming 4 11-19-2007 06:59 PM
inserting the data thru php in a text file suchi_s Programming 5 02-02-2005 03:28 AM
inserting/deleting characters into a text file ananthbv Programming 7 07-13-2004 11:40 PM
inserting text into a file DavidPhillips Programming 5 08-15-2003 04:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration