command-line

bash shell scripting combining *.txt into one file

What is the quickest and most pragmatic way to combine all *.txt file in a directory into one large text file? Currently I'm using windows with cygwin so I have access to BASH. Windows shell command would be nice too but I doubt there is one. ...

PHP command line interface passing in multiple files

I'm familiar with the basic of CLI and $argv array with php. Example: <?php // test.php var_dump($argv); ?> $php test.php datafile.txt 10 100 will produce: array(4) { [0]=> string(8) "test.php" [1]=> string(12) "datafile.txt" [2]=> string(2) "10" [3]=> string(3) "100" } What I'm trying to do is pass all files...

How can I read command line parameters from an R script?

I've got a R script for which I'd like to be able to supply several command-line parameters (rather than hardcode parameter values in the code itself). The script runs on Windows. I can't find info on how to read parameters supplied on the command-line into my R script. I'd be surprised if it can't be done, so maybe I'm just not using...

UNIX 'comm' utility allows for case insensitivity in BSD but not Linux (via -i flag). How can I get it in Linux?

Hi, I'm using the The excellent UNIX 'comm' command line utility in an application which I developed on a BSD platform (OSX). When I deployed to my Linux production server I found out that sadly, Ubuntu Linux's 'comm' utility does not take the -i flag to indicate that the lines should be compared case-insensitive. Apparently the POSIX s...

How can I shuffle the lines of a text file in Unix command line?

I searched SO for a similar Q/A to no avail. I want to shuffle the lines of a text file randomly and create a new file. The file may have several thousands of lines. How can I do that with cat, awk, cut, etc.? ...

How do you set the user from the command line in capistrano?

The following doesn't run as user bar, as I would expect. cap invoke COMMAND="cat foo" SUDO=1 -S user=bar I also tried cap invoke COMMAND="cat foo" SUDO=1 -s user=bar Is there some way to force capistrano to use a specific user from the cammand line? ...

How can I use Smart::Comments in a module I load without changing its source?

How can I specify that Smart::Comments be loaded for my original script, as well as for any of the modules it directly loads. However, since it is a source-filter, it would probably wreck havoc if applied to every module loaded by every other loaded module. For example, my script includes use Neu::Image; I would like to load Smart:...

How can I performance test using shell scripts - tools and techniques?

I have a system to which I must apply load for the purpose of performance testing. Some of the load can be created via LoadRunner over HTTP. However in order to generate realistic load for the system I also need to simulate users using a command line tool which uses a non HTTP protocol* to talk to the server. * edit: actually it is HTT...

Print command from C# application.

I want to write code that will print the Crystal Reports. But this command must go through DOS commands. How it is possible. (this is our client requirement) ...

Convert raw PCM stream to wavs (cli)

I need a program that I can pipe a raw PCM stream into, and will send wav files to stdout. Since the input is a stream, I can't just add headers to it, but I can for every x seconds (For example, program reads ten seconds of the stream, and outputs a ten second long wav file, reads the next ten seconds, outputs a wav file, and so on). ...

set file's icon in a command line utility not working

I just began to work with Objective-C and I'm managing pretty well. My last challenge was to make a command line utility, which I could than use in AppleScript. But my code does not work, not in the terminal, not in the AppleScript. So I'm asking you, what's the error in this peace of code, that should be very plain and easy? int main(i...

Parsing the output of Linux command 'who' in PHP

I've tried parsing a list of users currently connected via SSH to a server, but the results are very irregular, so I was forced to simply do: $users = shell_exec('who'); echo "<pre>$users</pre>"; Is there a better way to parse the output of who in the command line before I let PHP mess around with it? I want it in an array which conta...

How to enter a second parameter on the same command line on Windows Vista ?

I'm writing a Java program to simulate a command line feeder, it runs DOS commands like this : "Java -version" fine, but for something more complex, such as asking for a second parameter, it won't work, I roughly remember in Unix there is something like : "abc | 123" or maybe it's "abc < 123", I wonder in Windows command prompt is there ...

Cmdline Bash Variable Weirdness

I want to set an alias like so: alias hi='TEST=ok echo $TEST' However, it doesn't seem to work reliably. I start with: unalias hi unset TEST Then: $ alias hi="TEST=ok echo $TEST" $ hi $ This is on MacOSX: $ bash --version GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0) Copyright (C) 2005 Free Software Foundatio...

How do i monitor network traffic on Windows from the command line

How do i monitor network traffic on Windows from the command line; specifically the download/upload speeds and amount of data uploaded/downloaded ? Is there a script /batch for doing that ? ...

Invoke another command line app from within an awk block

I want to invoke curl (which invokes a REST service) for every matching row processed via awk. Input file (delimited by colon). e.g. $ cat /tmp/input tiger:EN haiti:FR federer:CH I got as far as this: awk -F':' '{print $1 "=" $2}' /tmp/input This just confirms that I can extract the columns out correctly. Now I need to invoke th...

How do I remove the difference in locale between gui and commandline interfaces of same program?

The program saves a settings file as text which contains floating point numbers of type long double. The settings file can only be saved via the GUI (GTK2), while files can also be loaded via the command line and without bringing up the GUI. Unfortunately, a user reports that in the files he has saved, due to his locale setting, the num...

how to deal with quotes in a string when passing that string to the command line

I can't get my head around quotes. EG, I have a string for an mp3 with quotes: string ARTIST = "John \"The Man\" Doe" I then want to pass this to a command line WITH the escape sequences. I therefore need my string to look like (I think): ARTIST = "John \\\"The Man\\\" Doe" So it looks like, for every time I have an (actual) " in ...

How do I run phpunit command in Windows command line no matter what directory I am in?

all examples of phpunit I saw run the simple command line tool: phpunit TestClass but when I try the same on a directory other than the xampp php dir, I end up getting an "unknown command..." Is there a way to execute the phpunit command from any directory in the Windows command line? ...

Does stdout have limitations

I had problems with imagemagik convert and unicode filenames. I then wrote a echo.bat which simply does echo %1. What came back in stdout via .NET wasnt my unicode characters. Is there some kind of character limitation? I havent tested length of characters i can pass as an argument is there a limit on that? ...