Hi all,
I have a huge tab-separated file formatted like this
X column1 column2 column3
row1 0 1 2
row2 3 4 5
row3 6 7 8
row4 9 10 11
I would like to transpose it in an efficient way using only using commands (I could write a ten or so lines Perl script to do that, but it should be slower to execute than the native bash functions). So...
Hi
Is there some command/script to know “EACH & EVERY” command executed on a solaris machine (with timestamp if possible) when multiple users are logged in with “SAME USERID & PASSWORD”?
history command is not accurate. It just shows the history of commands executed by that user or sometimes few more but it is not accurate when the s...
Hello All...
I am developing an application in Spring Web MVC where i need to execute some of the linux script..
I am using tomcat version 5.5 for running my project in linux..
My code is looking like this :
Process proc = runtime.exec("sudo cp /var/tmp/mailserverfiles/editinterface.txt /etc/sysconfig/network-scripts/editinterface.tx...
I see lots of examples and man pages on how to do things like search-and-replace using sed, awk, or gawk.
But in my case, I have a regular expression that I want to run against a text file to extract a specific value. I don't want to do search-and-replace. This is being called from bash. Let's use an example:
Example regular express...
I want to ask what are the cases when do we need to use Non blocking flag on file/socket descriptors means instead we can always use select function call to determine the ready descriptor. This is reference to program in section 16.2 of Unix Network Programming V1. In that program, why does the author sets non blocking flag on the 3 desc...
This program supposed to find command line arguments entered on Unix which ends with “.exe”. For some reason it doesn't work. Here is the code:
int main( int argc, char* argv[] )
{
for ( int i = 1; i < argc; i++)
if( findExe( argv[i] ) )
cout << argv[i] << endl;
return 0;
}
bool findExe( char* argument )
{
if ( s...
I am creating scripts which will store the contents of pipe delimited file. Each column is stored in a separate array. I then read the information from the arrays and process it. There are 20 pipe delimited files and I need to write 20 scripts. The processing that will happen in each script after the information is stored in the array is...
Calling fclose() here after dup()ing its file descriptor blocks until the child process has ended (presumably because the stream has ended).
FILE *f = popen("./output", "r");
int d = dup(fileno(f));
fclose(f);
However by manually performing the pipe(), fork(), execvp() of the popen(), and then dup()ing the pipe's read file descriptor,...
Hi
I would like to know how to generate assembler code from a C program using Unix.
I tried the gcc: gcc -c file.c
I also used firstly cpp and then try as but I'm getting errors.
I'm trying to build an assembler program from 3 different programs
prog1.c prog2.c prog.h
Is it correct to do gcc -S prog1.c prog2.c prog.h?
Seems that i...
Specifically, I need to call a version of exec that maintains the current working directory and sends standard out to the same terminal as the program calling exec. I also have a vector of string arguments I need to pass somehow, and I'm wondering how I would go about doing all of this. I've been told that all of this is possible exclusi...
What is the proper way to create a well-behaved Unix or Linux daemon in Ruby?
What is the definition of a well-behaved daemon anyway, and how would one write such a program in Ruby?
...
I'm trying to figure out a way to make demos for a program I've written with xlib, and I came across this, but, according to the author page:
This extension is not intended to support general journaling and playback of user actions.
Does anyone know of any functions in xlib that are intended to support playback of user actions? Does i...
how to use the find command to find files/directories which are not matching the pattern.
for eg:
find <some options > -name "dontfile.txt"
should give me output of all the find whose file name is not dontfile.txt
...
Hi All
What is the pre requisite to be able to use Unix's rlogin command?
Regards
Chaitanya
...
I have a perl script that writes out an array filled with integers to stdout, each on a separate line. So I would get output like:
412
917
1
etc
What I would like to do is be able to pipe the output of this script into xargs, and make a curl call using each integer. Something like this:
cat input.json | ./jsonValueExtracter.pl -s e...
How to get the list of all the files and folders in the root dir including sub-folders and their files.
...
I wrote a small Perl script to extract all the values from a JSON formatted string for a given key name (shown below). So, if I set a command line switch for the Perl script to id, then it would return 1,2, and stringVal from the JSON example below. This script does the job, but I want to see how others would solve this same problem usi...
How do I extract the last directory of a pwd output? I don't want to use any knowledge of how many levels there are in the directory structure. If I wanted to use that, I could do something like:
> pwd
/home/kiki/dev/my_project
> pwd | cut -d'/' -f5
my_project
But I want to use a command that works regardless of where I am in the dire...
So, let's say that I have a command, foo, in a script which has both a return value, and an output string that I'm interested in, and I want to store those into a variable (well at least its output for the variable, and its return value could be used for a conditional).
For example:
a=$(`foo`) # this stores the output of "foo"
if foo...
I have some data (separated by semicolon) with close to 240 rows in a text file temp1.
temp2.txt stores 204 rows of data (separated by semicolon).
I want to:
Sort the data in both files by field1, i.e. the first data field in every row.
Compare the data in both files and redirect the rows that are not equal in separate files.
Sample...