command-line

Using Select-String for checking two .txt files in powershell

坚强是说给别人听的谎言 提交于 2021-02-17 03:47:49
问题 I am complete new in writting powershell scripts. So far I was using plain batch for my purpose as this is the requirement by my company. Inside this batch I am using nested foor loops to make a comparison of two .txt files, in detail I wantdo do the following: File 1 contains lots of strings. Each string is in one seperate line with a preceded number and semicolon like so: 658;RMS File 2 is some long text. The aim is to count the amount of occurences of each string from File 1 in File 2, e.g

Windows environment variables change when opening command line?

六月ゝ 毕业季﹏ 提交于 2021-02-17 02:00:11
问题 Sometimes when I change my environment variables in Windows, and then use software the depends on those variables, they are not properly updated. And good example is to change a variable, then open up Windows Command Line and echo the variable and see that it hasn't been changed, even though you properly changed it in the Environment Variables window. Another example I'm dealing with right now: I've been using Python 2.4.x for a while for a project, which uses the env var PYTHONPATH who's

Cucumber Test execution for gradle project via command line using tags for cucumber feature files

为君一笑 提交于 2021-02-16 20:22:05
问题 I am looking to execute a cucumber test for a gradle project via command line using specific feature tags. The command I am using : gradle test -DCucumber.options="-tags @tagname" Command does execute the tags mentioned. I have tried using gradle test -DCucumber.options="-tags @tagname" and also gradle test .I didn't find any difference in both the command. gradle test -DCucumber.options="-tags @tagname" : Executes the Runtest.java and tags mentioned in this file, irrespective of what feature

How to grep an exact string with slash in it?

谁说胖子不能爱 提交于 2021-02-16 18:24:12
问题 I'm running macOS. There are the following strings: /superman /superman1 /superman/batman /superman2/batman /superman/wonderwoman /superman3/wonderwoman /batman/superman /batman/superman1 /wonderwoman/superman /wonderwoman/superman2 I want to grep only the bolded words. I figured doing grep -wr 'superman/|/superman' would yield all of them, but it only yields /superman. Any idea how to go about this? 回答1: You may use grep -E '(^|/)superman($|/)' file See the online demo: s="/superman

How to grep an exact string with slash in it?

两盒软妹~` 提交于 2021-02-16 18:24:05
问题 I'm running macOS. There are the following strings: /superman /superman1 /superman/batman /superman2/batman /superman/wonderwoman /superman3/wonderwoman /batman/superman /batman/superman1 /wonderwoman/superman /wonderwoman/superman2 I want to grep only the bolded words. I figured doing grep -wr 'superman/|/superman' would yield all of them, but it only yields /superman. Any idea how to go about this? 回答1: You may use grep -E '(^|/)superman($|/)' file See the online demo: s="/superman

Compiling from the command line

拟墨画扇 提交于 2021-02-16 17:56:34
问题 I'm trying to understand how works the option -classpath when compiling from command line. I try from parent of mydirectory : javac -cp mydirectory/subdir Hello.java But compiler says: javac: no sources files How does -cp ( -classpath ) work?? What am I doing wrong? If I make it from subdir directory: javac Hello.java then compiles properly. 回答1: javac TestProgram1.java TestProgram2.java TestProgram3.java You can use a wildcard to compile all the files in a folder, like this: javac *.java If

How to catch OS-COMMAND results in Progress-4GL?

时光怂恿深爱的人放手 提交于 2021-02-11 16:51:38
问题 I'm using the logging facilities, as described in this other post: OUTPUT TO VALUE("C:\Temp_Folder\logfile.txt"). ... PUT UNFORMATTED "Start : Check-zones" SKIP. ... OUTPUT CLOSE. This is working fine. Now I would like to add the results of an OS-COMMAND in the output file. I've already tried the following: (putting the results in a newly to be created file) OS-COMMAND NO-WAIT VALUE("WMIC printer get name, deviceID >> C:\Temp_Folder\Printers.txt"). This is working fine. So, I know the command

How to catch OS-COMMAND results in Progress-4GL?

此生再无相见时 提交于 2021-02-11 16:50:30
问题 I'm using the logging facilities, as described in this other post: OUTPUT TO VALUE("C:\Temp_Folder\logfile.txt"). ... PUT UNFORMATTED "Start : Check-zones" SKIP. ... OUTPUT CLOSE. This is working fine. Now I would like to add the results of an OS-COMMAND in the output file. I've already tried the following: (putting the results in a newly to be created file) OS-COMMAND NO-WAIT VALUE("WMIC printer get name, deviceID >> C:\Temp_Folder\Printers.txt"). This is working fine. So, I know the command

Running a cmd file without GUI popping up

断了今生、忘了曾经 提交于 2021-02-11 12:38:24
问题 I'm running a list of commands in a file: matlab -nodesktop -nodisplay -nojvm -nosplash ............. xwin32 --session .................... I would like to have them run without the GUI popping up in Windows and more of all I would like the command prompt GUI not to pop up, anyone have any idea how to do it? tnx 回答1: Best you can do on Windows is: batchScript.cmd start /B /MIN matlab.exe -nodesktop -noFigureWindows -nosplash ^ -r "surf(peaks); saveas(gcf, 'output.eps'); quit;" You can add the

Twisted lineReceived not getting called

。_饼干妹妹 提交于 2021-02-11 10:22:46
问题 I encountered a strange behavior when i was building a command line interface in python. Here is the striped down version of the code that can reproduce the issue. from twisted.internet import reactor, stdio from twisted.protocols import basic class CommandLine(basic.LineReceiver): def __init__(self): self.linebuf = '' self.setLineMode() # why lineReceived doesn't work? # def lineReceived(self, data): def dataReceived(self, data): print 'data received ' + ' '.join([str(ord(c)) for c in data ]