0

Please something wrong in this code, in input and output, i don't know how i can correct this code:

echo < in.txt | perl -CS -pe 's/[\x{0830}-\x{\x{9000}]+//g  > out.txt

The problem how i can import in.txt and export out.txt.

In sed it's easy like this

sed < in.txt > out.txt
zdim
  • 64,580
  • 5
  • 52
  • 81
silver
  • 105
  • 1
  • 7
  • 2
    exactly the same, `perl -e'...' < in.txt > out.txt` – zdim May 06 '19 at 23:54
  • 1
    (really, with [command switches](https://perldoc.perl.org/perlrun.html#Command-Switches) `perl -ne'...'` or `perl -pe'...'` so loop over STDIN is set up) – zdim May 07 '19 at 03:07

1 Answers1

1
  • echo doesn't read from STDIN.
  • You have an unmatched '.
  • \x{\x{9000} should be \x{9000}.
  • The range of characters you are removing is very peculiar, and surely incorrect. It starts in the middle of a seemingly arbitrary block, and it includes a huge swath of space that's not just unassigned, but not part of any blocks. I'm unable to fix this without more information.

Fixed:

perl -CS -pe's/[\x{0830}-\x{9000}]+//g' <in.txt >out.txt

or just

perl -CS -pe's/[\x{0830}-\x{9000}]+//g' in.txt >out.txt

See also: Specifying file to process to Perl one-liner

ikegami
  • 367,544
  • 15
  • 269
  • 518