#!/usr/bin/env perl # # txt_console_to_html.pl # # Example: # chmod +x txt_console_to_html.pl # ./txt_console_to_html.pl 20260518_1855_zerodev2_Gate2F_BilateralConstitution_90seconds.txt # # Subversion: # $Id$ # $HeadURL$ # use strict; use warnings; use File::Basename qw(basename); use POSIX qw(strftime); my $infile = shift or die "Usage: $0 console_capture.txt\n"; open my $in, '<:encoding(UTF-8)', $infile or die "Cannot open $infile: $!\n"; my $text = do { local $/; <$in> }; close $in; my $base = basename($infile); $base =~ s/\.[^.]+$//; my $timestamp = strftime('%Y%m%d_%H%M%S', localtime); my $outfile = "${base}_console_${timestamp}.html"; $text =~ s/&/&/g; $text =~ s//>/g; open my $out, '>:encoding(UTF-8)', $outfile or die "Cannot write $outfile: $!\n"; print $out <<"HTML"; $base $base $text HTML close $out; print "Wrote: $outfile\n";