From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fa528,86dd974acca45fb4,start X-Google-Attributes: gidfa528,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!22g2000hsm.googlegroups.com!not-for-mail From: charles.bowers@gmail.com Newsgroups: comp.unix.tru64 Subject: sed search and replace Date: Tue, 14 Aug 2007 17:21:28 -0000 Organization: http://groups.google.com Message-ID: <1187112088.131849.163100@22g2000hsm.googlegroups.com> NNTP-Posting-Host: 199.173.224.31 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1187112088 10184 127.0.0.1 (14 Aug 2007 17:21:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 14 Aug 2007 17:21:28 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; IE6SP1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 22g2000hsm.googlegroups.com; posting-host=199.173.224.31; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.unix.tru64:46 I'm trying to use a tag in sed, so I can tag part of the line and replace other parts as show below. Do you know what I'm doing wrong? sed 's/\nuserPrincipalName:(.+\n)/\nuserPrincipalName:\1uid:\1/g' OUTPUT-ba.txt > output.txt output-ba.txt userPrincipalName: Joe Mama userPrincipalName: Yo Mama output.txt userPrincipalName: Joe Mama uid: Joe Mama userPrincipalName: Yo Mama uid: Yo Mama