The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
changing text outthere_3 Shell Programming and Scripting 2 02-12-2008 09:46 PM
Changing text in the command prompt unipepper Shell Programming and Scripting 10 03-07-2007 09:49 AM
Changing Text Color Using VT100 Abed Alnaif UNIX for Advanced & Expert Users 4 11-27-2006 01:10 PM
changing last 2 digits of text kingdbag Shell Programming and Scripting 4 11-07-2006 02:51 PM
changing size of text at xterm armen Shell Programming and Scripting 3 04-25-2005 06:17 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 01-12-2002
Registered User
 

Join Date: Oct 2001
Location: Toronto, Ontario, Canada
Posts: 34
Question Changing text with sed?

Hi everyone,
Having trouble with sed. I searched the board and found some stuff, but still unclear.

I have a file named "userfile" which stores the users info in this form: email:username:password:

I want the user to be able to change their password.
i tried with sed s/oldpass/newpass/g userfile and it displayed to the standard output correct. then when i checked the userfile, it was still using the old password.

Then i found the "c" flag which is change. but then i try to test sed s/oldpass/newpass/c userfile i get a message
Function s/oldpass/newpass/c cannot be parsed

Can anyone help me? im just trying to allow a user to update their password and have the changes saved in userfile.

thanks!
primal
Forum Sponsor
  #2  
Old 01-12-2002
Cameron's Avatar
Registered User
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 490
Try ...
sed "s/oldpass/newpass/g" userfile > userfile.new
mv userfile userfile.old
mv userfile.new userfile
  #3  
Old 01-12-2002
Registered User
 

Join Date: Oct 2001
Location: Toronto, Ontario, Canada
Posts: 34
whoo-hoo!! it worked!!
thanks Cameron
primal
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0