unix

How to format a dos path to a unix path on cygwin command line

When using Cygwin, I frequently copy a Windows path and manually edit all of the slashes to Unix format. For example, if I am using Cygwin and need to change directory I enter: cd C:\windows\path then edit this to cd C:/windows/path (Typically, the path is much longer than that). Is there a way to use sed, or something else t...

What is the safest way to pass strings around in C?

I have a program in C using Solaris with VERY ancient compatibility it seems. Many examples, even here on SO, don't work, as well as lots of code I've written on Mac OS X. So when using very strict C, what is the safest way to pass strings? I'm currently using char pointers all over the place, due to what I thought was simplicity. So...

Unix timestamp and mysql date: birthdate

Hi, I have a really basic question concerning unix timestamp and mysql date. I'm trying to build a small website where users can register and fill in their birthdate. Problem is that unix starts with Jan 01 1970. Now if i calculate age for users, form dates like date('m.d.Y', $unix_from_db) and so on it will fail with users older that 4...

Sorting Scientific Number With Unix Sort

I tried to sort these number with Unix sort, but it doesn't seem to work: 2e-13 1e-91 2e-13 1e-104 3e-19 9e-99 This is my command: sort -nr file.txt What's the right way to do it? ...

Use matching value of a RegExp to name the output file.

I have this file "file.txt" which I want to split into many smaller ones. This a piece of it: 0 id:2293 7:0.78235 12:0.69205 17:0.79421 21:0.77818 .. 4 id:2293 7:0.78235 8:0.97904 12:0.69205 17:0.31709 .. 1 id:2294 7:0.78235 8:0.90994 17:0.49058 21:0.59326 .. Each line of the file has an id field which looks like "id:1"...

output redirection in UNIX

I am a beginner in UNIX. I am finding some difficulty in input/output redirection. ls -l >temp cat temp Here why temp file is shown in the list and moreover, it is showing 0 characters. wc temp >temp cat temp here output is 0 0 0 temp. Why lines, words, characters are 0. Please help me to undestand this concept. ...

Client Server problem with connect() or accept()

Hello, all. I'm having a bit of weird problem with client server program. I have two different kinds of clients trying to connect to one server, one is just more barebone than the other with less things to do. But other wise they are practically the same. While the barebone code can connect to server and server accepts it fine, the elabo...

piping in UNIX doubt

In The Unix Programming Environment by K & P, it is written that " The programs in a pipeline actually run at the same time, not one after another. This means that programs in a pipeline can be interactive;" How can programs run at same time? For ex: $ who | grep mary | wc -l How grep mary will be executed until who is run or how wc -...

can anyone tell me what -a in unix means?

Can anyone tell me what -a means in unix. Please see the following code: if [ "$x" = "$x" -a "y" -eq 0 ] ; then echo $x else echo $y ...

special character in UNIX

I want to add backspace character literally in my file named junk. So I did following $ ed a my name is happy\b (here b means I typed backspace so \ gets disapperaed and cursor sits sfter y) . w junk q But when I do $ od -cb junk it doesn't show backspace. ...

Run a UNIX command in a thread from a Bash script

Hiya, Problem background I have a post-commit script for my SVN repository which archives & backs up the incremental dumpfiles when a checkin is made. I'd like to update this to make an off-site backup, however the off-site copy could take a few minutes to complete if the checkin is large. Question Is it possible in a UNIX bash scri...

Running job in the background from Perl WITHOUT waiting for return

The Disclaimer First of all, I know this question (or close variations) have been asked a thousand times. I really spent a few hours looking in the obvious and the not-so-obvious places, but there may be something small I'm missing. The Context Let me define the problem more clearly: I'm writing a newsletter app in which I want the ac...

Enabling curl in php5

Hello, I am using macports on my machine and I realized that curl is not enabled. Is there anyway to enable it without completely reconfiguring php? Thanks! ...

Python Fabric: How to handle arbitrary remote shell prompt for input?

This is related to this question here, but with a slight twist: instead of just passing 'yes' or 'no', I need Fabric to pass an arbitrary string to the remote shell. For instance, if the remote shell prompts for 'what is your name?' then I need to feed it 'first,last'. Clarification: I know I said arbitrary input, but I was really tryi...

JBOSS Monitoring tool on UNIX

I have a web application deployed on a jboss server running on a unix machine. I want to be able to monitor threads, CPU times ,requests, etc. , for gauging application performance on the server. What might be the best way to do this? ...

Pipeline For Downloading and Processing Files In Unix/Linux Environment With Perl

I have a list of files URLS where I want to download them: http://somedomain.com/foo1.gz http://somedomain.com/foo2.gz http://somedomain.com/foo3.gz What I want to do is the following for each file: Download foo1,2.. in parallel with wget and nohup. Every time it completes download process them with myscript.sh What I have is this...

FreeBSD handbook in PDF

Could I get FreeBSD handbook in PDF without converting? ...

Gems install fine but don't show as installed under rake gems

I'll show you my output here: rake gems (in /Users/jp/Sites/central/trunk) - [F] authlogic - [R] activesupport - [F] builder - [F] formtastic - [R] activesupport >= 2.3.0 - [R] actionpack >= 2.3.0 - [ ] fastercsv I = Installed F = Frozen R = Framework (loaded before rails starts) Making sure fastercsv is i...

How to remove EXIF data without recompressing the JPEG?

I want to remove the EXIF information (including thumbnail, metadata, camera info... everything!) from JPEG files, but I don't want to recompress it, as recompressing the JPEG will degrade the quality, as well as usually increasing the file size. I'm looking for a Unix/Linux solution, even better if using the command-line. If possible, ...

Bourne Shell: Graceful way to get exit status

Is there a more graceful way to do this (bourne shell)? IsThereAnyApplesLeft applesLeft=$? Normally in c or java I would do: applesLeft=IsThereAnyApplesLeft ...