简体   繁体   中英

Input and output file in perl terminal

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
  • 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM