雑誌 (Linux Shell Handbook) で見たものをテストしようとしています。私は実際にこのようなことを試したことはありませんが、これが役立つ可能性があることは知っています
例は
perl -n -e '/^The \s+(.*)$/ print "$1\n"' heroes.txt
hero.txt には
Catwoman
Batman
The Tick
Spider-Man
Black Cat
Batgirl
Danger Girl
Wonder Woman
Luke Cage
Ant-Man
Spider-Woman
そして、これはティックを表示するはずですが、私は得ています
perl -n -e '/^The \s+(.*)$/ print "$1\n"' heroes.txt
syntax error at -e line 1, near "/^The \s+(.*)$/ print"
Execution of -e aborted due to compilation errors.
どこが間違っていますか??