Results 1 to 3 of 3
Hi there!
I've written a simple shell script for moving some files, but before I move one of the .ini files, I would like to replace "userid=12321" with "userid=4565" (for ...
- 07-27-2011 #1Just Joined!
- Join Date
- Jul 2011
- Posts
- 1
Script to replace text
Hi there!
I've written a simple shell script for moving some files, but before I move one of the .ini files, I would like to replace "userid=12321" with "userid=4565" (for instance). If it matters, the ini file contains multiple lines.
Thanks.
- 07-27-2011 #2If you want to do the replace in FILE, then add this flag -iCode:
sed 's/userid=12321/userid=4565/' FILE
You must always face the curtain with a bow.
- 08-04-2011 #3Just Joined!
- Join Date
- Aug 2011
- Posts
- 3
As Irithori pointed out, sed is the correct command to do this. The syntax is:
Good luck with your script!Code:sed 's/Pattern_to_be_replaced/New_Pattern_to_replace/' -i File_Name


Reply With Quote