ianw1974 Posted December 21, 2006 Report Share Posted December 21, 2006 I have a script that is extracting some data from an old LDAP server, and creating an ldif file. The problem I have is the parameters on the new ldap server use a different format. What I'm wanting to do, is replace a character, with another character. For example, this line: mailAlternateAddress= I want to replace the "=" with a ":" instead. How could I do this? Here is the line that gets the data: user_mailaltaddr=`./lds uid=$UUID mailAlternateAddress | grep -v uid= | grep -v version` so what I'm wanting to do is find "mailAlternateAddress=" and change this to "mailAlternateAddress:" Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted December 21, 2006 Author Report Share Posted December 21, 2006 I solved it. I couldn't use it on the variable, so I got it to create the file normally, and then I just did: sed 's/mailAlternateAddress=/mailAlternateAddress:/g' old.ldif > new.ldif this then read the first file created, and created a new file with the amendments. Quote Link to comment Share on other sites More sharing options...
ramfree17 Posted December 21, 2006 Report Share Posted December 21, 2006 doesnt sed has an edit in place option? ciao! Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted December 21, 2006 Author Report Share Posted December 21, 2006 I've no idea, first time I used it today :P This worked, so I'm not fussed, maybe I'll play with it a little later on. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.