Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ iconv -f UTF-16LE -t UTF-8 myfile.txt | grep pattern
- #! /usr/bin/env perl
- use strict;
- use warnings;
- die "3 args are required" if scalar @ARGV != 3;
- my $if =$ARGV[0];
- my $of =$ARGV[1];
- my $pat=$ARGV[2];
- open(my $ifh, '<:encoding(UTF-16LE)', $if) or warn "Can't open $if: $!";
- open(my $ofh, '>:encoding(UTF-16LE)', $of) or warn "Can't open $of: $!";
- while (<$ifh>) { print $ofh $_ if /^$pat/; }
- rg pattern filename
Add Comment
Please, Sign In to add comment