On Friday 25 April 2003 17:05, Jonathan Hutchins wrote: > Quoting Steven Elling : > > cat old.ldif | > > sed -e 's/(dn:.*)/1,ou=contacts,dc=tarcanfel,dc=net/' > new.ldif > > Excellent! So that "1" is what does the trick? You're half right. In your regex, you must have a subexpression; which is defined by using a regex between '(' and ')'. The backreference --- 1 in this case --- refers to the text matched by the 1st subexpression. All the gory details are in the ed(1) manpage. > s/,mail=.*// What is your goal here? Remember, . (dot) refers to any character and with * (astriks) following the dot this regex will match 'mail=' followed by zero or more characters. In effect, this substitution will remove everything from 'mail=' to the end of the line. If that is your goal, good. > /modify/d I haven't seen this before. I take it you want to match lines containing 'modify' and then delete the whole line. Am I right?