The one-liner, perl -ni -e'print; print "uid:", $1, $/ if /^cn:(.*)/;' foo.file
Update: Argh, I missed that bit, too. Off the top of my head, perl -ni -e'print; if (/^cn:(.*)/) { my $uid = "uid:$1\n"; my $nl = <>; print $nl =~ /^uid:/ ? "": $uid, $nl}' foo.file Untested.
After Compline,
Zaxo
In reply to Re: Perl File Manipulation
by Zaxo
in thread Perl File Manipulation
by topperge
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |