ianw1974 Posted December 21, 2006 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:" Link to comment Share on other sites More sharing options...
ianw1974 Posted December 21, 2006 Author 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. Link to comment Share on other sites More sharing options...
ramfree17 Posted December 21, 2006 Share Posted December 21, 2006 doesnt sed has an edit in place option? ciao! Link to comment Share on other sites More sharing options...
ianw1974 Posted December 21, 2006 Author 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now