unix-utils

Do you know a similar program for wc (unix word count command) on Windows ?

A quick search gives me tawbaware wc, but it does not accept stdout as input stream, meaning I can not use pipe within a DOS session. Note: I can not install cygwin or use powershell (which would have allowed a '|foreach-object {(get-content $_).count}') unxutils and and gnuwin32 Packages might have this feature... ...

rearrange data

If I have a list of data in a text file seperated by a new line, is there a way to append something to the start, then the data, then append something else then the data again? EG a field X would become new X = X; Can you do this with bash or sed or just unix tools like cut? EDIT: I am trying to get "ITEM_SITE_ID :{$row['ITEM_SITE_ID...

How do you determine what to put in .rhosts file in an VAX open vms when accessing from CYGWIN

How do you determine what to put in .rhosts file in an VAX openvms system when trying to remotely access the server using a remote shell from Cygwin on windows XP ? .rlogin and rsh are the only methods that can be used to access the VAX server and it must be using Cygwin to remote in to the VAX server. SSH is not an option. When the VAX ...

concatenating many email files with unix utils

I would like to know if there is any easy way to print multiple emails(about 200) so that they continue on as opposed to printing one per page. I have tried with thunderbird and evolution and this does not seem possible. Would concatenating the individual mail files work or are there other unix utilities that could do this? WOuld sed or ...

Tools for creating text as bitmaps (anti-aliased text, custom spacing, transparent background)

I need to batch create images with text. Requirements: arbitrary size of bitmap PNG format transparent background black text anti-aliased against transparency adjustable character spacing adjustable text position (x and y coordinates where text begins) TrueType and/or Type1 support Unix command line tool or Python library So far I've...

Why would a TAR file be smaller than it’s contents?

I have a directory I’m archiving: $ du -sh oldcode 1400848 $ tar cf oldcode.tar oldcode So the directory is 1.4gb. The file is significantly smaller, though: $ ls -l oldcode.tar -rw-r--r-- 1 ieure ieure 940339200 2002-01-30 10:33 oldcode.tar Only 897mb. It’s not compressed in any way: $ file oldcode.tar oldcode.tar: POSIX tar arch...

Reading chunks of a remote file without transferring the whole file ?

Is it possible via any Unix utility to read chunks of a remote file (like say 'head' does) instead of transferring the whole file ? ...

Changing Editor for Unix INFO Command

Currently my "info" command uses Emacs as its default editor. $ info printf Is there a way to change it into Vi/Vim? ...

wc gzipped files?

I have a directory with both uncompressed and gzipped files and want to run wc -l on this directory. wc will provide a line count value for the compressed files which is not accurate (since it seems to count newlines in the gzipped version of the file). Is there a way to create a zwc script similar to zgrep that will detected the gzipped...

Enter password multiple times

I am running an application, which prompts for a password of the user about a dozen times :-( I tried using expect to circumvent this issue, and make it run in auto mode, but am unable to get over the issue of the multiple times password, which is not exactly static. Sometimes it asks 4-5 times and sometime around 9-10 times. Is there a...

How to load ANSI escape codes or get coloured file listing in WinXP cmd shell ?

This is related to this question : How to get coloured file listing in windows cmd shell ? I'm trying to get, wouldn't you believe it, coloured file listing in windows cmd shell. Windows are XP SP2, if that matters. In the old DOS days there used to be little programs like hdir, adir and such which displayed that nice. Nowadays, such pr...

How to compare 2 symbolic links in unix (Linux)?

What would be an elegant way of comparing 2 symbolic links in Unix? Assume I have entered the following commands: ln -s /usr/share/g s1 ln -s /usr/share/g s2 ln -s ../share/g /usr/lib/s3 ln -s /usr/share/h s4 then I would like to have a command that says that s1 and s2 are equal (whether /usr/share/g actually exists is not relevant),...

Which program creates a C array given any file?

I remember seeing in the past a program that would take any file and generate a C array representing that file as output; it would prevent distribution of a separate file in some cases. Which Unix/Linux program does that? ...

How i configure logrotate to not delete my log files after rotation?

There's a way to do this? ...

need help removing time from a csv file

im trying to process a csv and make it easier for sorting, and i need to remove the time and the dash from it. the file has entries like this: James,07/20/2009-14:40:11 Steve,08/06/2006-02:34:37 John,11/03/2008-12:12:34 and parse it into this: James,07/20/2009 Steve,08/06/2006 John,11/03/2008 im guessing sed is the right tool for t...

How to grab an arbitrary chunk from a file on unix/linux

I'm trying to copy a chunk from one binary file into a new file. I have the byte offset and length of the chunk I want to grab. I have tried using the dd utility, but this seems to read and discard the data up to the offset, rather than just seeking (I guess because dd is for copying/converting blocks of data). This makes it quite slow ...

Parsing files that use synonyms

If I had a text file with the following: Today (is|will be) a (great|good|nice) day. Is there a simple way I can generate a random output like: Today is a great day. Today will be a nice day. Using Perl or UNIX utils? ...

Unix-style tools on Windows?

At work (a mostly Unix development shop), I've had an OS X box for the past 1.5 years and a Linux box before that. Due to various circumstances, I'll be getting a Windows XP laptop in the next few weeks. I'm of mixed feelings about this - it's good in that, as a manager, I'm used to running a Windows install (via Parallels) for Excel, Ou...

How do I include a blank line between files I'm concatenating with "cat"?

I want to cat all the files in a directory, but include some spacer between each one. ...

Sending the command(s) spawned by xargs to background

I want to know how I can send the command(s) spawned by xargs to background. For example, consider find . -type f -mtime +7 | tee compressedP.list | xargs compress I tried find . -type f -mtime +7 | tee compressedP.list | xargs -i{} compress {} & .. and as unexpected, it seems to send xargs to the background instead? How do I m...