#!/usr/bin/perl -w use strict; use warnings; use Text::CSV; binmode STDOUT, ':utf8'; my $csv = Text::CSV->new ({ binary => 1 }) or die "Cannot use CSV: ".Text::CSV->error_diag(); $csv->eol("\n"); sub ee { my ($s) = @_; $s =~ s/&/&/g; $s =~ s//>/g; return $s; } print <<'End'; Steam Games End my %already; my ($info); while (my $line = ) { chomp $line; $csv->parse($line) or die "can't parse line: $line"; my ($id, $name, $tags) = $csv->fields(); next if $already{$id}++; my $name_esc = ee($name); my @tags = split / /, $tags; my $proto = (grep {$_ eq "linux"} @tags) ? "steam" : "steamwine"; print < End } print <<'End';
id image name tags
$id $name_esc @tags
End