unix

Shell Script to download files

I am trying to write a unix shell script to download all the files in a directory posted on a website. How would I go about doing this? Thanks playas ...

Can't read or write to directory CFFILE despite 777 permissions coldfusion

This is installed on a Unix system I don't have direct access to, but can get insight on by sitting with a network team. The problem is this, I have 3 folders I need access to, read and write. The problem is, I only have access to 1 of them, and only read. This is via ColdFusion, I can get into them fine with the user they are assigne...

FTP quote RCMD CALL from Ubuntu Server to remote UNIX system

I have a file containing my clients articles that weekly needs to be uploaded to a remote UNIX server via FTP and a remote command is used to read the articles into their system (an agency that keeps track of EAN-codes). The people running the remote server gave my client a batch-file to run in order to upload this article file to the se...

Creating an "at" job from command line for a MYSQL query

From the command line, I want to create an at job to run a mysql query. As you can imagine searching on google or here stackoverflow for "at" is difficult. This works fine and the query runs like it ought to: mysql -e 'MY QUERY;' but if I do this: at 17:30 mysql -e 'MY QUERY;' At 5:30 I get a mail that tells me "UPDATE: command n...

Deleting a line from a file, reading and rewriting is very inefficient ... can someone come up with a better algorithm?

Hi, Deleting a particular line/certain bytes from a file is very inefficient as there is a lot of reading and writing(re-writing) to be done. Is there anyway we can minimize work in such a process? Imagine if an entire file is a set of linked lists and as a user we know the structure of these linked lists then wouldn't it be wonderful a...

Find file ending with .sh OR .bin

How can I find all the files ending with .sh OR .bin in a given folder. I know I can do: find /path/to/folder -name "*.bin" to find all bin file. What must I add to also look for .sh files ? ...

Finding Paths in Directed Graph with Greedy Approach With At Least K Nodes and a Given Starting Node

I have a non-weighted DAG graph. What I want to do is to find all the paths in a greedy way and the path should contain at least K nodes, and a given starting node. Is there any existing algorithm/implmentation that does that? For example I have the following graph: my %graph =(36=>[31],31=>[30,22],30=>[20],22=>[20,8],20=>[1],8=>[5],...

How does SIGINT relate to the other termination signals?

On POSIX systems, termination signals usually have the following order (according to many MAN pages and the POSIX Spec): SIGTERM - politely ask a process to terminate. It shall terminate gracefully, cleaning up all resources (files, sockets, child processes, etc.), deleting temporary files and so on. SIGQUIT - more forceful request. It...

UNIX:How to convert ip address to binary code

Is there is any Command to convert ip address in to binary form? Eg: 10.110.11.116 output: 00001010.01101110.00001011.01110100 ...

How can I find the connected components of a graph in Perl?

I have the following collection of nodes and edges. What I want to do is to find all the distinct graph from it. my %connections=(36=>[31],10=>[3,4],31=>[30,22],30=>[20],22=>[20,8],20=>[1],8=>[5],5=>[2],2=>[1,20], 3=>[7]); In this example it will yield: my %all_graph = { graph1 => {36=>[31],31=>[30,22],30=>[20],22=>[20,8],20=>[1...

Converting relative path into absolute path

Not sure if its a duplicate. Given the relative path, how do i determine absolute path using a shell script? Example: relative path: /x/y/../../a/b/z/../c/d absolute path: /a/b/c/d ...

List the details of a network directory with a shell script.

This is new to me a little. But my objective is to run a script that will display the directory of a network drive. I am on a mac and the network drive is a local SMB connection. I have been able to use ls ~/Documents and that lists a specificed local directory, but I am unable to get it to show contents of a network directory. BTW...

Average of column by hours (rows) using awk

Hello, I have the following rows in a file that I want to get the average of the 3rd column by hour. 2010-10-28 12:02:36: 5.1721851 secs 2010-10-28 12:03:43: 4.4692638 secs 2010-10-28 12:04:51: 3.3770310 secs 2010-10-28 12:05:58: 4.6227063 secs 2010-10-28 12:07:08: 5.1650404 secs 2010-10-28 12:08:16: 3.2819025 secs 2010-10-28 13:01:...

How can I find files that are bigger/smaller than x bytes?

In terminal, how can I find files that are bigger or smaller than x bytes? I suppose I can do something like "find . -exec ls -l {} \;" then pipe the result to awk to filter by file size. But shouldn't there be an easier way than this? Thank you. ...

"Variable $foo will not stay shared" Warning/Error in Perl While Calling Subroutine

Dear All, Update3: If you like this posting please don't upvote me but upvote the genius answer by DVK below. I have the following subroutines: use warnings; #Input my @pairs = ( "fred bill", "hello bye", "hello fred", "foo bar", "fred foo"); #calling the subroutine my @ccomp = connected_component(@pairs); use...

Is it possible to use crypt command of unix without user prompt for key

I want to use crypt command for encrypting a file, but the key I want to keep fixed and not give a user prompt for entering a key ...

Find cron jobs that run between given times

Is it possible to find all entries in a crontab that run between time X and time Y without having to parse the cron time entries myself? I'm mainly concerned with time hour and minute, not so much the other 3 time fields. ...

Using netcat (nc) as an HTTP proxy server and monitor

Is it possible to use the Unix netcat (nc) program to create a TCP proxy server and monitor? I would like all TCP traffic to be passed across the pipe, as well as sent to stdout for monitoring. Note this will be used for monitoring HTTP traffic between a hardware device and an HTTP server. ...

Unix C - Compiling for 64 bit breaks "dirname"

I'm using dirname from libgen.h to get the directory path from a filename's path. This is it's signature: char * dirname (char *path) When compiling on a 32 bit machine or using -m32 with gcc, it all works fine. My code looks like this: char* path = "/path/to/my/file.txt"; char* path_cpy = strdup(path); const char* dir = (const cha...

C# Mono on Unix - File system ACLs

Are there methods in Mono C# to interact with file ACLs and extended ACLs? I found the assembly Mono.Posix.dll, and the class UnixFileInfo. This can give me nice things like the owner group and user, but no ACLs. Does it exist? Or would I have to basically use DllImport for everything? ...