How to use UNIX commands in Perl? (to be used on a Windows machine)

2016-08-23T23:20:46

I need to filter the content of one file (javasrc.txt) by the contents of a second file (OEMDS.txt). This needs to be done in a Windows environment. I don't know about Windows batchfiles, I know about UNIX commands, I'm new at Perl and I would like to make my life as easy as possible, so I have thought of writing a UNIX command, put "system()" around it and it should work.

Unfortunately it seems not to be that simple: the following Perl script refuses to work:

system("cat javasrc.txt | grep -v qx(cat OEMDS.txt) > javasrc_temp.txt");

I get error message:

grep: OEMDS.txt): No such file or directory

For your information: I have already used the following for launching the cat command:

- backticks
- $()
- qx()
- qx{}

Always the result is the same: Perl seems to have an issue with the terminating character (the second backtick or comma, ...)

Now that I think about it, I launch this in the following way (I don't know if it's relevant):

perl filter_by_file_content.pl

Does anybody know what I can do?

Copyright License:
Author:「Dominique」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/39105076/how-to-use-unix-commands-in-perl-to-be-used-on-a-windows-machine

About “How to use UNIX commands in Perl? (to be used on a Windows machine)” questions

I need to filter the content of one file (javasrc.txt) by the contents of a second file (OEMDS.txt). This needs to be done in a Windows environment. I don't know about Windows batchfiles, I know ab...
Hi Stackoverflow guys, I am a newbie to Java and have a dumb basic question. I have generated a keystore on windows machine and used to enable https in windows tomcat. My question is whether i can...
I have a Perl script running on a Windows machine. I need this script to open a ssh session to a remote Unix machine, and to be able to execute certain commands on that Unix machine and to be able ...
I tried using some Unix command using the subprocess module on my Python interpreter installed on a windows 7 OS. However, it errors out saying command not found. It does recognize Windows commands
I need to execute multiple system commands in parallel on a remote unix machine(only through ssh) from my windows machine. I have used paramiko module to do the ssh to the remote machine. In the same
I am getting some perl compile errors trying to convert these unix commands to perl. The use of single quotes and double quotes is throwing me off (see below: my $curlcmd). Here's the working unix
I want to create an SSH session to a remote machine using Perl, and execute commands automatically from a Windows machine. Is there a way I can do that?
I am working on a unix machine and the only way to execute oracle sql commands is through a unix script we grant access like this : #! /user/bin/ksh User = 'PATH' # I can't read the file in this p...
Is it possible to use sed and awk kind of commands in python that works on windows operating system? For Unix operating system we can import os package and use os.system to perform any unix operati...
I used to use several Unix-based commands with Anaconda 2 (i.e., Python 2.7) in Windows 7. For example, these commands ls, mkdir, rm,... can work properly with Anaconda Command Prompt. Recently, I...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.