Hello, I have little problem with specifying my variable. I have a file with normal text and somewhere in it there are brackets [ ] (only 1 pair of brackets in whole file), and some text between them. I need to capture the text within these brackets in a shell (bash) variable. How can I do that, please?
...
If I am counting on my write() system call to write say e.g., 100 bytes, I always put that write() call in a loop that checks to see if the length that gets returned is what I expected to send and, if not, it bumps the buffer pointer and decreases the length by the amount that was written.
So once again I just did this, but now that the...
I have started to customize my .dbxrc file to save some time while debugging. What is yours favourite entry in .dbxrc file ? here is mine:
export PS1='[ (dbx) Working Hard @ $(date +%H:%M:%S) ]'
alias si="stop in"
alias attr=attribute
alias bfth=stop
alias blth=stop
alias c=cont
alias cv=condition
alias d=delete
alias e=edit
alias h=h...
I'm on OS X (with bash) and a newbie at unix. I want to know if it's possible to amend some file such that to run a ruby program, I don't need "ruby file.rb", but instead can just run "ruby.rb".
Is there a reason NOT to do this?
Thanks!
...
What command do I want to issue when I want to know the IP address of the Solaris machine I'm logged onto?
Thanks in advance for any suggestions.
--James
...
I need to run a process, wait a few hours, kill it, and start it again. Is there an easy way that I can accomplish this with Python or Bash? I can run it in the background but how do I identify it to use kill on it?
...
how to get hostname with IP without logging into the host
...
I want to be able to configure something like this.
I want to run job 'X' at 7 AM everyday starting from 29/june/2009 till 30/12/2009. Consider current date as 4/4/2009.
...
I have some files on my Unix machine that start with
--
e.g. --testings.html
If I try to remove it I get the following error:
cb0$ rm --testings.html
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
I tried
rm "--testings.html" || rm '--testings.html'
but nothing works.
How can I remove such...
I am trying to check if a symbolic link exists from korn shell script using "-h filename" command.This works good on HP boxes.
Not sure what is the correct option for Linux,AIX and Solaris boxes.
...
What is the line
#!/usr/bin/env python
in the first line of a python script used for?
...
Dear all,
I have no problem using the following command of AWK as a stand alone command,
without any error:
$ awk '$9 != "NTM" && $9 != ""' myfile.txt | less -Sn
But when I apply them inside Perl's script for qsub (i.e. running job in linux cluster) command, like this:
use strict;
use Data::Dumper;
use Carp;
use File::Basename;
my...
Given this data
34 foo
34 bar
34 qux
62 foo1
62 qux
78 qux
I want to replace the string at 2nd column into "" if it is "qux".
Resulting:
34 foo
34 bar
34
62 foo1
62
78
How do you do that with sed? In particular the data is very big with ~10^7 lines
...
I want to output top 10 lines of AWK command in the list of files given by find,
using this snippet:
$ find . -name "*.txt" -print -exec awk '$9 != ""' \| head -n10 {} \;
Note also that I want to print out the file names being processed.
But why I get such error:
awk: cmd. line:2: fatal: cannot open file `|' for reading (No such fi...
How can I su from root to db2inst1 and invoke a SQL script all in 1 line? I am thinking about something like this:
su db2inst1 | db2 CONNECT TO myDatabase USER db2inst1 USING mypw; db2 -c -i -w -td@ -f /tmp/deploy/sql/My.sql | exit;
Any ideas?
...
I have application hosted Apache UNIX, and I am allowing users to access the application url from citrix environment (from citrix machine).
However, currently its possible to access the url from all the connected machines. I would like to put the restriction that it should be only accessed from citrix machine. So if any one needs to ac...
I have two files in which some of the lines have changed order. I would like to be able to compare these.
One website suggested something that looks like this:
diff <(sort text2) <(sort text1)
But this yields the error: Missing name for redirect.
I am using tcsh. Is the command above for a different shell?
Is there a better way?
...
I'm writing a shell script to automatically add a new user and update their password. I don't know how to get passwd to read from the shell script instead of interactively prompting me for the new password. My code is below.
adduser $1
passwd $1
$2
$2
...
I have a folder Math at /cs/.../topology/mathematics/Math.
I tried the following unsuccessfully at the mathematics -folder.
mv Math/ ..
How can you move the folder Math to /cs/.../topology/ in terminal?
...
I would like to keep my ssh command hidden/disguised from other users.
Example:
ssh user@host -i /my/private/key
Unfortunately this will come up in the ps listing and other users will be able to see the private key file that I am using. Is there a way around this?
(They are logged in as the same user as I am)
...