Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/src/ape/lib/openssl/demos/b64.pl

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/usr/local/bin/perl

#
# Make PEM encoded data have lines of 64 bytes of data
#

while (<>)
	{
	if (/^-----BEGIN/ .. /^-----END/)
		{
		if (/^-----BEGIN/) { $first=$_; next; }
		if (/^-----END/) { $last=$_; next; }
		$out.=$_;
		}
	}
$out =~ s/\s//g;
$out =~ s/(.{64})/$1\n/g;
print "$first$out\n$last\n";



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].