I am trying to write a tiny script that accepts any number of command line arguments that prints out the rwx permissions for a file (not directory)
What I have is
file=$@
if [ -f $file ] ; then
ls -l $file
fi
This accepts only one command line argument however. Thanks for any help.
...
I am using Toad. Frequently i need to compare tables in two different test environments.
the tables present in them are same but the data differs.
i just need to know what are the differences in the same tables which are in two different data bases.Are there any tools which can be installed on windows and use it to compare.
Much apprec...
I am a novice in unix.
i am facing a problem in viewing big log files in unix using Vi tool.
could you please suggest the best tool for fast viewing of big files on unix.
Request you to post your own ways of viewing the big files on unix.
appreciate your help:)
...
I'm using this but it's replacing single occurances of a new line with <br/><br/>
function nl2br2($string){
$string = preg_replace('/(\r\n){2,}/', '<br/><br/>', $string);
//$string = preg_replace('/[\r\n]/', '<br/>', $string);
return $string;
}
It happens with the first pattern.
...
Hi.
I'm using unix scoket for data transferring (SOCK_STREAM mode)
I need to send a string of more than 100k chars. Firstly, I send length of a string - it's sizeof(int) bytes.
length = strlen(s)
send(sd, length, sizeof(int))
Then I send the whole string
bytesSend = send(sd, s, length)
but for my surprise "bytesSend" is less tha...
Hello,
I am creating a file with php. I just want to be able to create it, with no content, under a directory. Then I want to be able to edit it when I access my server with ftp. I can't! The user of php is different from the ftp user, and this last one does not have permissions to change it! I tried chmod,umask,chown, but nothing works....
How do I throw the contents of binary log to bit bucket? I tried to create a soft link but it did not work.
I do not want to save mysql general log but I want to watch it using tail -f command.
ln -s /dev/null /var/log/mysql/mysql-gen.log
ln: creating symbolic link /var/log/mysql/mysql-gen.log to /dev/null: File exists
...
Is there some *nix tool or perl/php library that will let you easily create directory tree visualizations that look like the following?
www
|-- private
| |-- app
| | |-- php
| | | |-- classes
| | | +-- scripts
| | |-- settings
| | +-- sql
| +-- lib
| +-- ZendFramework-HEAD
+-- public
|...
Hi,
How can I produce a regular expressions pattern that returns the filename from any one of these lines? (I will search one line at a time).
drwxrwxrwx 4 apache apache 4096 Oct 14 09:40 .
drwxrwxrwx 11 apache apache 4096 Oct 13 11:33 ..
-rwxrwxrwx 1 apache apache 16507 Oct 17 10:16 .bash_history
-rwx...
The POSIX standard defines several routines for thread synchronization, based on concepts like mutexes and conditional variables.
my question is now: are these (like e.g. pthreads_cond_init(), pthreads_mutex_init(), pthreads_mutex_lock()... and so on) system calls or just library calls? i know they are included via "pthread.h", but do t...
An example of the process/output would be:
File1:
hello
world
File2:
foo
bar
Resulting file after concatenation:
File3:
hello;foo
world;bar
For a large list of non-predictive text (no-wild cards - but lines are aligned as above).
I cannot figure out how to do this with the paste command under Ubuntu.
...
The following code is working as expected. But I can not format the output.
It will print something like this:
mysql
test
someDB
I want the output on a single line
mysql test someDB
I tried using sed in the script but it did not work.
#!/bin/sh
for dbName in `mysqlshow -uroot -pPassWord | awk '{print $2}'`
do
echo "$dbName" | egr...
I'm editing a network protocol frame stored a file in Unix (\n newlines). I need to insert the carriage return character (U+000D aka \r). When I try to paste it from the clipboard ("+p) or type it using Ctrl+Shift+u-000d, the linefeed is inserted (U+000A).
What is the right way to do it?
...
I want to change a number such as 1234567890 to 456-7890; is there a way to do this in Unix Shell programming?
...
I am writing a code in C on a unix system. I have created a message queue server. Each time I receive a new message I fork and the child process handles the new client. The server waits for new client. Here's the code.
for (;;)
{
struct my_msgbuf buf;
if (msgrcv (msqid, &(buf.mtype), sizeof (buf), 1, 0) == -1)
perror ("msgrcv")...
I'm looking for a good collection of libraries for ANSI-C, stuff for handling vectors, hash maps, binary tress, string processing, etc.
...
Hi,
How can I allow the shell session to stay open until I close it with PHP?
In my example I want to use NcFtp to publish some files through shell command. I want to leave PHP's built in FTP because it is much much slower and performance is an issue.
It is easy to use ncftpput to publish a file or a directory. But if I want to loop t...
I have files with these kind of duplicate lines, where only the last field is different:
OST,0202000070,01-AUG-09,002735,6,0,0202000068,4520688,-1,0,0,0,0,0,55
ONE,0208076826,01-AUG-09,002332,316,3481.055935,0204330827,29150,200,0,0,0,0,0,5
ONE,0208076826,01-AUG-09,002332,316,3481.055935,0204330827,29150,200,0,0,0,0,0,55
OST,0202000068,...
I want to write a program that reads stdin (unbuffered) and writes stdout (unbuffered) doing some trivial char-by-char transformation. For the sake of the example let's say I want to remove all chars x from stdin.
...
File1:
<a>hello</b> <c>foo</d>
<a>world</b> <c>bar</d>
Is an example of the file this would work on. How can one remove all strings which have a <c>*</d> using sed?
...