command-line

counting duplicates in a sorted sequence using command line tools

I have a command (cmd1) that greps through a log file to filter out a set of numbers. the numbers are in random order, so i use sort -gr to get a reverse sorted list of numbers. there may be duplicates within this sorted list. I need to find the count for each unique number in that list. For e.g. if the output of cmd1 is 100 100 ...

Writing a portable command line wrapper in C.

I'm writing a perl module called perl5i. Its aim is to fix a swath of common Perl problems in one module (using lots of other modules). To invoke it on the command line for one liners you'd write: perl -Mperl5i -e 'say "Hello"' I think that's too wordy so I'd like to supply a perl5i wrapper so you can write perl5i -e 'say "Hello"'. I...

sed to replace TTLs in a tinydns zonefile?

I'm working to replace a large set of TTLs inside some tinydns zonefiles. Regardless of what the TTL is currently set to, I want it to become 900. I'm looking for some sed magic, and I'm almost there it seems. I have about 50 hostnames to replace the TTL, and the zones are sporadically assigned. The lines in the zonefiles don't need ...

NSLog not printing to terminal

Ok, so I've been using NSLog in objective-C for awhile now to debug and I know it's supposed to print to the terminal whatever I put in the parentheses. For some reason, it just stopped printing to the terminal and I'm not sure how to fix this error. I was wondering what other people would suggest doing to fix this problem. I've only inc...

Error with propel-generate-crud in Symfony 1.0

When I try to generate a CRUD test for a new project I am getting a PHP Warning and a Fatal Error. The errors relate to files that it cannot find, however, I have checked and the files are definitely there. The error text is 'require_once(lib/model/map/QuestionMapBuilder.php): failed to open stream: No such file or directory in c:\webr...

Most powerful examples of Unix commands or scripts every programmer should know

There are many things that all programmers should know, but I am particularly interested in the Unix/Linux commands that we should all know. For accomplishing tasks that we may come up against at some point such as refactoring, reporting, network updates etc. The reason I am curious is because having previously worked as a software test...

How do I get the name of the active user via the command line in OS X?

How do I get the name of the active user via the command line in OS X? ...

Convert arbitrary document to PDF using command line

I'm looking for a simple (free) way to convert an arbitrary document to a PDF from within a program. There are any number of free PDF printers, but I need to be able to call the conversion within a program without human intervention. The program is being developed in Java, but will run exclusively in a Windows environment so calling an ...

Files with long extensions unexpectedly deleted using command prompt

i am trying to delete some files using a batch file.. (winxp) my problem is when i delete using a wildcard.. it is matching the 8.3 name aswell as the long name. eg: file list file1.py file1.pyc file2.pycstlongname file2.pycstlongnamec if i do a Del *.pyc it deletes everything but file1.py becuase if i do a dir /X all of teh 8...

Add commandline arguments to service installer c#

I am working on an application which starts as a service but only if a commandline switch tells it to (otherwise a standard form is opened). So when the service is started by Windows at bootup, it must pass this commandline option or the service fails to start. I would like to have the installer (ServiceProcessInstaller) add a commandl...

Is there a better way to pass command line arguments to my programs in VC++?

I'm writing a program in C++ and it takes some command line arguments. The only way I know to pass command line arguments in VSC++ is to open up the properties and navigate to the command line argument field and enter them in, then run it. That's not exactly streamlined if I want to pass in different arguments each time I run it. The ot...

recursively add file extension to all files

I have a few directories and sub-directories containing files with no file extension. I want to add .jpg to all the files contained within these directories. I've seen bash scripts for changing the file extension but not for just adding one. It also needs to be recursive, can someone help please? ...

Is there a standard way to list expected command line arguments?

I don't mean a man page or equivalent. You know how, when you start command line applications with insufficient or invalid command line arguments, they often output a one-liner showing the command line arguments they expected, then quit. Is there a standard way to write this one-liner? (i.e. Which command line arguments are required, w...

Is there a package to process command line options in R?

Is there a package to process command-line options in R? I know commandArgs, but it's too basic. Its result is basically the equivalent to argc and argv in C, but I'd need something on top of that, just like boost::program_options in C++, or GetOptions::Long in perl. In particular, I'd like to specify in advance what options are allow...

Programmatically empty out large text file when in use by another process

Hey everyone, I am running a batch job that has been going for many many hours, and the log file it is generating is increasing in size very fast and I am worried about disk space. Is there any way through the command line, or otherwise, that I could hollow out that text file (set its contents back to nothing) with the utility still ha...

Shortest way to swap two files in bash

Can two files be swapped in bash? Or, can they be swapped in a shorter way than this: cp old tmp cp curr old cp tmp curr rm tmp ...

How to package a command line Python script

I've created a python script that's intended to be used from the command line. How do I go about packaging it? This is my first python package and I've read a bit about setuptools, but I'm still not sure the best way to do this. Solution I ended up using setup.py with the key configurations noted below: setup( .... entry_points=...

Should I include a command line mode in my applications?

For learning purposes i'm developing a Class generation application in c# and winforms. I think It could be fine to include a command-line mode that allow to use the application in scripts. It's a good practice to include a command-line mode in my applications? It would be better to have two different programs, one with GUI in one for t...

how to insert contents of a file into a blob column in a table using sqlite3

Hi everyone i need to insert the contents of a file into a blob column in sqlite3 but the thing is that i just wanna know whether it is possible by command line statement regards shroff ...

run command in each subfolder

What is the easiest way to run a command in each subfolder of a path? In this case I have to run svn cleanup for every directory in my repository. ...