command-line

Why use argparse rather than optparse?

I noticed that the Python 2.7 documentation includes yet another command-line parsing module. In addition to getopt and optparse we now have argparse. Why has yet another command-line parsing module been created? Why should I use it instead of optparse? Are their new features I should know about? ...

How to properly run Perl "one liner" command line scripts?

I'm new to using Perl to call the linux command line and have looked through a number of tutorials but still can't figure out what I am doing wrong.. I am trying the code below (in a .pl perl file, as an executable): #!/usr/bin/perl perl -e 'print "Hello";' I run this script and get: "Execution of /home/user1/Desktop/file_backups.pl...

Change all with command line

I'm wondering if there is a way to change a specific word in all of the files within the /www/ directory using command line. Just looking for a faster way to change out a specific word so I don't need to open all the files manually! Thanks! ...

Linux command to find text in most recent file matching name pattern

I have a directory of files like so: parent /dir1 file1 file2 other something name_pattern.o23409284 name_pattern.o29203429 name_pattern.o39208235 /dir2 ... I want to run a command that will look in the newest name_pattern.o* file for a line beginning with: ***END ...

Simple Terminal Command Question - Is there a command to pull a certain line out of an input?

Hey guys, I have a simple question. Is there a command that allows you to pull a certain line out of an input? Like if I wanted the 7th line from ifconfig. Is there a way to do this: ifconfig | [command] 7? Thanks! ...

PHP - Calling .php file from command line produces no output

I have a simple cmd.php page to run commands I enter using shell_exec () and show the output. PHP is running as CGI Entering "php -v" and most commands just show "Content-type: text/html" and then the current page's HTML source. However, calling PHP with an invalid parameter (/usr/bin/php -z) shows PHPs usage: Usage: php [-q] [-h] [-s...

Chaining commands to use ls to recursively list files modified in last 24 hours?

Hi, Can someone help me with chaining commands to use ls to recursively list all files modified in last 24 hours? Thank you!!!! JG ...

How to find file that is missing a required string?

On my OS X command line, I would like to find all files ending in .per that are missing the string 'connection_id'. How do I go about doing this. Finding the files that have a given string is easy but am not sure how to do this if the string is missing. Thanks! ...

How to parse command line arguments in python?

I would like to be able to parse command line arguments in my python 2.6 program. Ideally, I want to be able to handle these cases: # show some help ./myprogram --help # these are equivilent ./myprogram --block=1 ./myprogram -b 1 # this means verbose, and twice as verbose: ./myprogram -v ./myprogram -vv ...

Include and Execute EXE in C# Command Line App

Hey all, So I found a great little EXE command line app (we'll call it program.exe) that outputs some data I would like to manipulate with C#. I was wondering if there was a way to "package" program.exe into my visual studio project file, so that I could hand my compiled application to a co-worker without having to send them program.ex...

windows command line: how to remove space in file

Hi In linux, we can do it with tr command to remove space. How can I do it in windows? I like to remove space in each line of a text file from command line in Windows XP. Thanks. ...

How to view the method members of a class within a jar file thru the command line

I am trying to look at the method members of a class within a jar file. Currently to list all the classes within a jar file, one can call this command: jar -tf myjar.jar but if i want to list the public methods within a particular class in this jar file, How do i go about it. Thanks ...

How Do I Send Command Prompt Arguments from a Windows Form Application in C# for .NET?

This one should be an easy one. An example would be the following: The user clicks a button titled "Ping" and it uses the command prompt "ping" to ping the server. The output is captured in a string and displayed in the windows forms app to the user. ...

Perl, executing linux shell commands that are multi-line, require authentication?

I've been looking around but can't figure this out.. I figured out how to do a perl execution of a shell script, such as: #!/usr/bin/perl $cmd = "nautilus"; system $cmd; However, I want to do a shell script execution from perl that would do something like this on the command line: su $password nautilus So it would become root, then...

Parsing command-line arguments from a STRING in Clojure

I'm in a situation where I need to parse arguments from a string in the same way that they would be parsed if provided on the command-line to a Java/Clojure application. For example, I need to turn "foo \"bar baz\" 'fooy barish' foo" into ("foo" "bar baz" "fooy barish" "foo"). I'm curious if there is a way to use the parser that Java o...

Handling multiple application versions via Commandline

I have a situation where we are releasing a new version of our application, and I was wondering how other people handle the situation where they have a datafile and opening/editing that file. In the previous version of the application users could make a backup file which contains all the necessary parts of the system to transport and re...

Executing .jar file from PHP through Command prompt

Hi, I have a .jar file which has a command line interface. I want to call the jar file through command prompt and capture the output of the Jar file. I have tried with the exec() command. The command I have used is: <?php exec('java -jar D:\\Development\\Filehandler\\dist\\Filehandler.jar \ getConfigLang', $result); echo $result; echo...

How do I get Ivy to copy the dependencies to the lib directory when using it from the command line?

I have the following command: java -jar ...\ivy-2.2.0-rc1.jar -ivy ...\ivy.xml Which I am expecting to resolve the dependencies and copy them to the lib folder of my project. Ivy seems to resolve the dependencies but does not do the copy. If I run the ant task the copy happens correctly. Does anyone know why the copy to lib does no...

Command line option to tell msi installation to a specific location

Is there anyway to install the msi at specific location through the command line. ...

Calling command prompt from Qt application without freezing?

Hello, In my Qt GUI application, I am calling the command prompt through: system("lots.exe & of.exe && commands.exe"); It opens up the command prompt (like I want it to), but freezes the Qt GUI application until I close the command prompt. Is there someway to prevent this? I saw that there is a QProcess class, but can't get it to br...