Why is this Perl command failing on the Windows command line?

I am trying to replicate the Perl command from this answer on Ask Ubuntu in a Windows command line environment. I believe I have downloaded Perl for Windows and installed it correctly, so the error seems to be one of syntax.

The original command in a Linux shell is:

ls | perl -pe 's/(.)(.*)_(\d{4})(\d{2})(\d{2})_(\d+).jpg/\u$1$2,$3-$4-$5,$6,$&/' . filename.csv

I believe the Windows version should be:

dir > perl -pe 's/(.)(.*)_(\d{4})(\d{2})(\d{2})_(\d+).jpg/\u$1$2,$3-$4-$5,$6,$&/' >> expenses.csv

However, this is the error I’m getting:

Invalid switch – “(.)(.*)(\d{4})(\d{2})(\d{2})(\d+).jpg”. ‘/” is
not recognized as an internal or external command, operable program or
batch file.

What is the correct syntax for running this Perl command in Windows?

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s