unix

output of one command is argument of another

Is there any way to fit in 1 line using the pipes the following: output of sha1sum $(xpi) | grep -Eow '^[^ ]+' goes instead of 456 sed 's/@version@/456/' input.txt > output.txt ...

System.IO.Path or equivelent use with Unix paths

Is it possible to either use the System.IO.Path class, or some similar object to format a unix style path, providing similar functionality to the PATH class? For example, I can do: Console.WriteLine(Path.Combine("c:\\", "windows")); Which shows: "C:\\windows" But is I try a similar thing with forward slashes (/) it just reverses t...

Why do I get strange output from Perl using SQL?

Here is my Perl code: foreach my $line (@tmp_field_validation) { chomp $line; my ($cycle_code,$cycle_month,$cycle_year)= split /\s*\|\s*/, $line; $cycle_code=~ s/^\s*(.*)\s*$/$1/; $cycle_month=~ s/^\s*(.*)\s*$/$1/; $cycle_year=~ s/^\s*(.*)\s*$/$1/; print "$line\n"; print "$cycle_c...

Why is used umask ?

I am reading some source code and I found at the very begin of the main routine this statement: umask(077); What could be the reason for that? The man page (man 2 umask) states: umask -- set file creation mode mask This clearing allows each user to restrict the default access to his files But is not clear to me why wo...

create backup file descriptor?

stdinBackup = 4; dup2(0, stdinBackup); Currently I am doing the above to 'backup' stdin so that it can be restored from backup later after it has been redirected somewhere else. I have a feeling that I am doing a lot wrong? (eg arbitrarily assigning 4 is surely not right). Anyone point me in the right direction? ...

How do I change the effective user of psql?

I'm using psql to run a simple set of COPY statements contained in a file: psql -d mydb -f 'wbf_queries.data.sql' where wbf_queries.data.sql contains lines: copy <my_query> to '/home/gvkv/mydata' delimiter ',' null ''; ... but I get a permission denied error: ... ERROR: could not open file ... for writing: Permission denied I'm ...

FtpWebRequest Download File

The following code is intended to retrieve a file via FTP. However, I'm getting an error with it. serverPath = "ftp://x.x.x.x/tmp/myfile.txt"; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverPath); request.KeepAlive = true; request.UsePassive = true; request.UseBinary = true; request.Method = WebRequestMethods.Ftp.Dow...

Does HP-UX limit the size of /opt ?!

It's all in the title! Thx. ...

ImageMagick - how to enforce min/max heights/widths?

Using ImageMagick, how can I resize an image to have a minimum: height of 150px width of 200px and also have a maximum: height of 225px width of 275px UPDATE: In case it helps, here's a further explanation of what I'm experiencing. I have a buch of images with all different ratio dimensions. Some images have 1:5 height/width ra...

BASH: How to remove all files except those named in a manifest?

I have a manifest file which is just a list of newline separated filenames. How can I remove all files that are not named in the manifest from a folder? I've tried to build a find ./ ! -name "filename" command dynamically: command="find ./ ! -name \"MANIFEST\" " for line in `cat MANIFEST`; do command=${command}"! -name \"${line}\" ...

Condition Variable in Shared Memory - is this code POSIX-conformant?

Does the POSIX standard allow a named shared memory block to contain a mutex and condition variable? We've been trying to use a mutex and condition variable to synchronise access to named shared memory by two processes on a LynuxWorks LynxOS-SE system (POSIX-conformant). One shared memory block is called "/sync" and contains the mutex ...

monitor and kill runaway processes using 100% IO?

Hello everyone, i have a few processes that have to be run at high priority (chrt 98) that will occasionally decide to hard-lock and peg 1 core at 100% (not a huge deal) but more importantly it will use all the IO on a system, so much that its impossible to log into the machine via ssh to kill it or perform any task on the machine that i...

How to send a simple string between two programs using pipes?

I tried searching on the net, but there are hardly any resources. A small example would suffice. EDIT I mean, two different C programs communicating with each other. One program should send "Hi" and the other should receive it. Something like that. ...

UNIX script to parse Zone file (is this the best code?)

Hi, FOund the following on: http://mike.murraynet.net/2009/08/23/parsing-the-verisign-zone-file-with-os-x/ Can unix-masters have a look at it and see if its the best possible way to gather the unique domainsnames in a zone file? For .NET domains: grep “^[a-zA-Z0-9-]+ NS .” net.zone|sed “s/NS .//”|uniq >> netdomains.txt For .COM domai...

Any book that covers internals of recent versions of Unix OS

This summer I'm getting into UNIX (mostly *BSD) development. I've graduate level knowledge about operating systems. I can also understand the code & read from here and there but the thing is I want to make most of my time. Reading books are best for this. From my search I found that these two books "Unix Internals: The New Frontiers"...

First Come, First Served process scheduling

i have 4 processes: p1 - bursts 5, priority: 3 p2 - bursts 8, priority: 2 p3 - bursts 12, priority: 2 p4 - bursts 6, priority: 1 Assuming that all processes arrive at the scheduler at the same time what is the average response time and average turnaround time? For FCFS is it ok to have them in the order p1, p2, p3, p4 in the executi...

file content into unix variable with newlines

I have a text file test.txt with the following content: text1 text2 And I want to assign the content of the file to a UNIX variable but when I do this: testvar=$(cat test.txt) echo $testvar the reult is: text1 text2 instead of text1 text2 Can someone suggest me a solution for this? ...

How to count number of lines in the files which created today

Well,I m trying to list the number of files created today and the count the number of lines in those files.I have to do it in unix.Please suggest how to write script for this. ...

set oracle user Display so i can install

running oracle enterprise linux the Oracle installer keeps telling me that my DISPLAY variable isn't set. however echo display clearly prints ":0.0" logged in as root I am able to run xclock to launch the app, but when I "su oracle" and then run xclock it refuses [oracle@devsebl ~] xclock Xlib: connection to ":0.0" refused by server X...

makefile: how to call macros in macros

Hello, I have the following macros in my make file: pdf: // do something clean: // just another fancy thing No I want to declare a macro all: which include (or call) the macros above. The following thing doesn't work: all: pdf: clean: I don't want to repeat the code from pdf: and clean: in order not to rebel agains...