extracting a particular pattern from a line
I have lines of text in a file where, inserted in each line, a pattern
exists (digits and dashes) such as:
one two 9-8 three 2-up
once 8-11 4-over quadruple
time never 22-20 always
What I want to extract is this:
9-8
7-11
22-8
The patterns of digits and dashes are always surrounded by spaces and
the digits are never more than sequences of two digits in a row.
If possible, I would also like to extract the digits followed by
alphabetic characters (if they exist) such as:
2-up
4-over
In all instances, digits are preceded by spaces and
|
9/9/2010 1:50:31 AM
|
0
|
Lao Ming <laoming...@gmail.com>
|
|
|
Parallel make problem (gnu-make)
Trying parallel make for aa and bb targets, but not for cc target by
typing "make" . The following runs serial for all 3 targets.
all: def cc
def: MAKEFLAGS=-j2
def: aa bb
aa bb cc:
for f in 1 2 3; do echo $@:$$f; sleep 1; done
TIA
jl
|
9/9/2010 12:37:32 AM
|
0
|
James <hslee...@yahoo.com>
|
Fast search
I=B4m looking for the best way to searching for the "06/09" in position
56->60:
> cat nbp_file
1160309 BKP_DIARY1_49 Backup Done 1 06/09 19:07
05/09 01:14 004:10:13 GSASVDMXSM3144 6249 F 100
1160310 BKP_DIARY1_55 Backup Done 1 05/09 19:07
06/09 01:14 004:10:13 VEMAGSSMWL2799 6249 F 100
I need make this search in a file with 100 000 lines.
Thanks.
|
9/7/2010 3:08:45 AM
|
0
|
contracer <contrace...@gmail.com>
|
printf question
G'day
I have a collection of sql scripts in one directory. Each script begins
with a header, one line of which is a description e.g.
rem usage: sqlplus '/as sysdba' @ ...
set echo on
rem filename: dba_what_blocks.sql
rem description: what sessions are blocking other sessions?
set echo off
rem history 07 sept 2010 AJ Created
the following code, run at the command line, produces the this output:
for file in dba_*.sql ; do printf ${file} \t ; grep "rem description"
${file}; printf "\n" ; done
Outp
|
9/7/2010 11:53:21 PM
|
0
|
Ant <...@example.com>
|
How do I create this file on a remote machine?
Hi,
I'm running Mac 10.6.3 locally.
I have added my key to the authorized_keys of a remote machine,
dave@remote, so that I can ssh into the remote machine without a
password. However, how can I run a command on my local machine, and
then write the output to a file on the remote machine at /opt/output ?
The command I want to run locally is a shell script with an argument,
sh /opt/scripts/dave_script.sh arg1
Thanks for your help, - Dave
|
9/7/2010 9:51:52 PM
|
6
|
laredotornado <laredotorn...@zipmail.com>
|
rename files in directory
I have several thousand files like the following:
SolTrdBra_09062010_00_A0.pdf SolTrdBra_09062010_00_E0.pdf
SolTrdBra_09062010_00_I9.pdf SolTrdBra_09062010_00_MJ.pdf
SolTrdBra_09062010_00_B0.pdf SolTrdBra_09062010_00_ED.pdf
SolTrdBra_09062010_00_IM.pdf SolTrdBra_09062010_00_N0.pdf
SolTrdBra_09062010_00_BG.pdf SolTrdBra_09062010_00_G0.pdf
SolTrdBra_09062010_00_J1.pdf SolTrdBra_09062010_00_PP.pdf
I need to change the date portion of the file to look like the
following:
(add hyphen to date portion of file name)
SolTrdBra_09062010_00_J1.pdf SolTrdBra_09-06-2010_00_PP.pdf
|
9/7/2010 2:59:18 PM
|
7
|
"aixd...@yahoo.com" <aixd...@yahoo.com>
|
grep doubt
Hi,
Please help me how to find 19 in file below:
> cat list
19 getservbyname failed
119 Data type overflow or underflow
190 found no images or media matching the selection criteria
191 no images were successfully processed
>
a="19 "
grep $a list
|
9/6/2010 7:13:08 PM
|
18
|
contracer <contrace...@gmail.com>
|
Copy stdout/stderr to a file
I want to run an executable and display its contents. Sometimes the
contents include the word "ERROR". I want to be able to run the
program, show all the contents, then see if the word Error is there. I
could do
program > somefile 2>&1
cat file
if [ -z `grep ERROR somefile` ] ; then
echo "An error occurred"
exit 1
fi
but that would not show the contents until after I'd run the program.
I'd like to show all the contents as the prgram runs, then afterwards
grep for the word ERROR.
I thought I could do this with "tee", but I don't seem to be getting
anywhere.
Any sugge
|
9/6/2010 8:19:50 AM
|
2
|
"Dr. David Kirkby" <david.kir...@onetel.net>
|
single string outputted multiple times w changes
I have a simple string of zeros and ones in which the ones are
regularly positioned
e.g 00100010001000 (the 'real' string is much, much longer)
I can't fathom how to derive, from this simple input, 3 new lines as
follows:
00110000000000
00000011000000
00000000001100
The original unit is 1000; the replacement one is 1100.
Each line of required output is a combination of the original units
and a single instance of the replacement.
I sense this wld be much easier if there was a candidate for FS which
wasn't a one or zero. So turning the original thing into 00 1000 1000
1
|
9/5/2010 10:07:53 PM
|
6
|
"thdyo...@googlemail.com" <thdyo...@gmail.com>
|
Equally Tab Spaced Columns Through sed
Hi!
I have a somehow long file (almost 3000 lines) and I would like to
space each column using tabs, but I can't figure how to do that
through sed. Here you are an excerpt from the data I have:
Madagascar 1995 51.6
Malawi 1995 54.7
Saint_Vincent_and_the_Grenadines 2010 66.9
Samoa 2010 60.4
S=E3o_Tom=E9_and_Pr=EDncipe 2010 48.8
Saudi_Arabia 2010 64.1
I would like that each line could be as follows:
Madagascar 1995 51.6
Malawi 1995 54.7
Saint_Vincent_and_the_Grenadines 2010 66.9
Samoa 2010 60.4
S=E3o_Tom=E9_and_Pr=EDncipe 2010 48.8
Saudi_Arabia 2010 64.1
As
|
9/5/2010 7:52:23 PM
|
3
|
Nosophorus <nosopho...@gmail.com>
|
sudo and shell functions
Hello,
As a user, I have a couple of shell functions.
Sometimes I want to use these functions as root so I tried:
$ sudo my-func
env: my-func: No such file or directory
So now I'm wondering how this can be addressed.
I could just copy the functions in the root .bashrc, or better could
have a file gathering them shared and sourced by users and the root.
Are there any better solutions ?
Thanks
|
9/4/2010 10:49:41 AM
|
3
|
Francis Moreau <francis.m...@gmail.com>
|
delete mach and next two words in text file
Hello,
I have been trying to do this for a while now, still with no success.
Basically I have a file with several numbers all in one line separated
by a space. Every three numbers are values for one item. When the item
does not exist anymore I have to delete the entries in the file. This
means that if item 2 is gone, for example, values 3 4 5 have to be
deleted (item 1 would be values 0 1 2).
File example:
12 25 33 0 1 5222 89 90 3 67 67 0 12 56 11
First item = 12 25 33 (12 being in position 0 and 25 being in position
1 in the file and so on ...)
Second item = 0 1 5222
and
|
9/3/2010 1:01:52 PM
|
8
|
davide laneri <davide...@gmail.com>
|
find patten of file
Hi All
Machine : AIX 5.3
How to using grep to list file have 6 number ?
e.g.
-rw-rw---- 1 moonhkt amg 0 Sep 03 15:12 aaa9.txt
-rw-rw---- 1 moonhkt amg 0 Sep 03 15:06
aaa911212.txt
I can using egrep to list file, but find cannot
ls -lt -1 | egrep '[a-z]{1,3}[0-9]{6,6}.txt'
-rw-rw---- 1 moonhkt amg 0 Sep 03 15:06
aaa911212.txt
find ./ -name '[a-z]{1,3}[0-9]{6,6}.txt' -print
Change to find ./ -name '*.txt' -print | egrep '[a-z]{1,3}[0-9]
{6,6}.txt' | xargs ls -lt ; ok
How to just using find to list file ha
|
9/3/2010 8:50:48 AM
|
1
|
moonhkt <moon...@gmail.com>
|
setting dircolors--clarification
Alright having played with LS_COLORS a bit and figuring out what is going
on, I can now better describe exactly what I am looking for. If you look
at dircolors, you discover there are 8 foreground colors and 8 background
colors you can set the font to. Furthermore the eight colors are preset
and basic. Shoot the background yellow isn't even yellow on my system
it's orange.
Now what I would really like is a way to get more colors ( though eight
might just be enough ).; But also I want to chose the colors that I can
chose in my scheme.
In emacs you get all sorts of colors lig
|
9/3/2010 2:21:20 AM
|
1
|
Handy Gandy <handigandy-...@yahoo.com>
|
zsh: setting dircolors
I don't want to sound gay, but sometimes the colors in dircolors are just
well yucky. Not just ror aesthetic reasons, but sometimes the colors make
the test hard to read and sometimes the colors are so close that you
can't distinguish between them ( part of the point of using colors ).
Is there a way of changing the dircolor pallette?
|
9/2/2010 7:53:25 PM
|
1
|
Handy Gandy <handigandy-...@yahoo.com>
|
Weirdest shell behavior ever...
Okay, weirdest I've seen.
There's a hunk of shell code I use to generate some large hunks of source
code. The basic logic looks like this:
exec 5>wrapfuncs.c
for i in big_list
do
cat >&5 <<EOF
int $i(void) {
EOF
cat >&5 <<EOF
return 3;
}
EOF
cat >&5 <<EOF
int dummy_$i(void) { return 4; }
EOF
done
(The contents are actually much more complicated.)
Out of about fifty thousand runs, we've had two fail, both on the same
host, both on the same day. The failure is that the entire file
comes out fine, except that ONE instance (out of dozens) in the fi
|
9/1/2010 7:27:55 PM
|
10
|
Seebs <usenet-nos...@seebs.net>
|
bash; globals; no global; what did I do wrong?
Why isn't __SVNROOT being globally set. What'd I do wrong
Thank you
========================================
C_SVNROOT='SVNROOT'
__SVNROOT=
function svne_verify_svnroot (){
local iam='svne_verify_svnroot'
__SVNROOT=$(eval echo \$$C_SVNROOT)
echo value was JUST set $__SVNROOT >/dev/stderr <<<<<<== OK HERE
return 0
}
function setsvn {
local iam='setsvn'
if ! svnroot=$(svne_verify_svnroot) ; then
echo $svnroot
return 1
fi;
echo Still $__SVNROOT should be set >/dev/stderr <<<<<<< NOT seen
here
return 0
}
echo ========
|
8/31/2010 7:21:33 PM
|
0
|
okey <oldyor...@yahoo.com>
|
Variable substitution
Please help me with this variable substitution.
cleaning_tape inside "number" assignment doesn=B4t work:
cleaning_tape=3D`cat /tmp/tapes_robot_qualstar | grep ' CL' | awk
'{ print $3}'`
number=3D`/usr/openv/volmgr/bin/vmquery -m $cleaning_tape | grep left |
awk '{ print $3}'`
|
8/31/2010 3:10:08 PM
|
3
|
contracer <contrace...@gmail.com>
|
awk fields
Hi,
How verify with awk if field 15 haves number 8 ?
Command below doesn=B4t work...
cat tapes.lis | awk ' { if ($15=3D8) { print $0 }}'
|
8/30/2010 3:54:39 PM
|
7
|
contracer <contrace...@gmail.com>
|
GNU sed regex assistance needed
Hi all,
I'm working on a large wiki migration; there's one special case pattern
the supplied migration script isn't accounting for, and I'm apparently
far less skilled with sed than I originally hoped -- the correct command
has been eluding me for an hour now.
I'm trying to use GNU sed to change patterns like the following from
double square brackets to double angle brackets:
[[Include(SomeWiki/PageName)]]
into:
<<Include(SomeWiki/PageName)>>
A valid pattern inside the parentheses contains [A-Za-z0-9_.-/]
I thought this would work, but it does not and I'm clearly confused
|
8/26/2010 5:29:42 PM
|
1
|
Michael <mich...@nospam.example.com>
|
sed - what do these lines do ?
trying to reverse engineer somebodys script - what do the following lines do
when run against an input file:
sed '1,2d'
sed '2,3d'
I can see what they are doing to the data but I just want it explained for
my own sanity.
Thanks
|
8/26/2010 3:38:38 PM
|
8
|
"banzai" <ban...@aaaa.com>
|
Sed question
Trying to reverse engineer somebody's script. Can anybody tell me what the
following lines do ? - I can see what they do to the data that is parsed, i
just want the theoretical explanation. Thanks
sed '1,2d'
sed '2,3d'
sed '3,4d'
etc
|
8/26/2010 4:02:36 PM
|
3
|
"banzai" <ban...@aaaa.com>
|
How do I get this IP address into a file?
Hi,
I'm using a bash shell on Mac 10.6.3. When i run ifconfig -a, I get
(amongst other output):
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 34:15:9e:0f:b2:0e
inet6 fe80::3615:9eff:fe0f:b20e%en0 prefixlen 64 scopeid 0x4
inet 10.101.2.135 netmask 0xffffff00 broadcast 10.101.2.255
media: autoselect (100baseTX <full-duplex>)
status: active
Does anyone know how I can get the IP address (above: 10.101.2.135)
into a file, parsing it out from all other text?
Thanks, - Dave
|
8/24/2010 8:53:13 PM
|
17
|
laredotornado <laredotorn...@zipmail.com>
|
dash -n flag
Am I crazy or is this a bug in "dash"? The following was found on
Ubuntu 10, which uses dash as /bin/sh:
% /bin/sh -nvc foobar
/bin/sh: foobar: not found
According to my understanding of standards, and of every other shell
I've seen, the -n flag should prevent the shell from attempting to run
"foobar". In fact here's what the dash man page says:
-n If not interactive, read commands but do not execute them. This is
useful for checking the syntax of shell scripts.
This shell is clearly not interactive but proof is given by
% /bin/sh -n -c 'echo $-'
n
So: is this a well k
|
8/23/2010 3:06:57 PM
|
7
|
Adam Kellas <adam.kel...@gmail.com>
|
I HACK $3500 FROM PAYPAL...
I HACK $3500 FROM PAYPAL At http://quickpaypalmoney.tk
i have hidden the PAYPAL FORM link in an image.
in that website on Right Side below search box, click
on image and enter your name and PAYPAL ID.
|
8/21/2010 5:25:11 PM
|
0
|
paypal cash <magguri.ramula...@gmail.com>
|
Which shells have an "unknown hook" (like Tcl)?
Tcl has a feature where if you give it an unknown command, it invokes a
procedure which can attempt to resolve the command (perhaps by loading
the library that defines that command). I have a situation now where it
would be desirable to have that functionality in a "mainstream" shell.
I thought that tcsh would have it, but a cursory reading of the man page
did not reveal anything. Do any mainstream shells have this capability?
--
> No, I haven't, that's why I'm asking questions. If you won't help me,
> why don't you just go find your lost manhood elsewhere.
CLC in a nutshell.
|
8/21/2010 4:44:49 PM
|
2
|
gaze...@shell.xmission.com (Kenny McCormack)
|
error report
Hello. I want to scan log files for errors and report the count of
each uniq error type.
This gives me the list of unique types.
grep -i error logfile | awk '{print $3}' |sort | uniq
How can I also report the number of occurrances?
thanks
|
8/19/2010 6:49:43 PM
|
24
|
jimmy <bigtoeh...@hotmail.com>
|
101 stuff; ( ) and logic; bash
Is this correct?
This is what I want
if [ ! ( $a == $testing -a ( $b == $c -o $b == $d ) ) ] ; then
you have to escape the () ... correct?
if [ ! \( $a == $testing -a \( $b == $c -o $b == $d \) \) ] ; then
I just had to ask.. it's been a long time. Seems to work but didn't
remember ever having to do that.
Thanks.
|
8/19/2010 2:30:20 PM
|
7
|
okey <oldyor...@yahoo.com>
|
repeating a character a variable number of times
Using Bash on OS X
This works fine,
N=25
for i in $(jot $N); do echo -n '+'; done
echo
This also works fine
printf '#%.0s' {1..60}
This does not. I have tried every combination I can think of, but
nothing works for me
Here is my intent
N=45 # this will be some calculated value based on a string length
printf '#%.0s' {1..$N}
Thanks for any help...
|
8/18/2010 5:42:38 PM
|
29
|
mbs400 <...@mac-specialist.com>
|
background jobs in makefile
all:
for f in xx yy; do\
(make $$f &);\
done;\
wait
@echo [ $@:done ]
xx yy:
sleep 2
@echo [ $@:done ]
How do I put backgroud jobs in makefile?
"wait" does not seem to work here.
TIA
jl
|
8/18/2010 5:49:19 PM
|
0
|
James <hslee...@yahoo.com>
|
tw_cli command
Hi,
I have the below bash script for nagios plugin. The issue is that i
dont need to hard code the controller c0 or c1 or c2 or c3. so on some
servers there may be two controllers c0, and c1 and on some server
there may be four controllers c0,1,2 and 3. I dont know it off hand
Typically if i run tw_cli info i get
tw_cli info
Ctl Model Ports Drives Units NotOpt RRate VRate
BBU
------------------------------------------------------------------------
c0 9550SX-8LP 8 8 4 0 1 1
OK
c1 9550SX-8LP 8 8 2
|
8/18/2010 1:16:10 PM
|
1
|
kaushal <kaushalshri...@gmail.com>
|
ONLINE THESAURUS
..
Click Here to Enter:
>>> http://better-web-247.com/2/online-thesaurus <<<
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
..
online thesaurus
free online thesaurus
thesaurus online
roget's thesaurus online
online slang thesaurus
thesaurus free online
online websters dic
|
8/18/2010 6:47:15 AM
|
0
|
Rodney Villanueva <villanuevablrrrodney...@gmail.com>
|
awk processing question
Hi. I have this little bit of script that I am having trouble with. I
need to parse the contents of PATH statement and then verify that the
owner is ROOT and also that the directory is not world writable.
What I have is...
(string2parse will be something like: /sbin:/bin:/usr/bin:/usr/sbin )
echo $string2parse | awk '{ NF==1; n=split($0,a,":");
for (i=1; i<=n; i++)
system(" ls -ald " a[i])
} '
I'm getting stuck after doing the display using the system() function.
Uptil then it all works quite w
|
8/17/2010 6:45:36 PM
|
5
|
Kush <kushvinder....@scotiabank.com>
|
Can you illuminate this dark corner of shell programming? (escaping $ in backquote substitution)
I've been studying portable shell programming for a few months now.
I've wrapped my head pretty well around the subject, persistently
tracking down the various mysteries I've found along the way, but
there is one mystery left which I just have not been able to crack. So
I come to you, wizards of comp.unix.shell, in search of enlightenment.
When using backquote command substitution, why on Earth does a
backslash get annihilated when preceding the $ character?
To illustrate what I'm talking about, consider the following sample
code:
$ cd /tmp
$ testvar=3D`echo $PWD`
What does
|
8/17/2010 6:47:42 AM
|
10
|
Randall Cotton <recot...@earthlink.net>
|
Consistent ps/top output format
Hi,
The output of top/ps appear to differ across variants on several OS-
es, even with the command line options that are mentioned in the docs.
Is there a way to display the data in a consistent OS-independent
format ?
I would be looking for something like this:
PID USER THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
978 root 1 8 -20 5636K 2964K nanslp 18.2H 0.10% perl
8003 bind 1 4 20 28012K 1892K kqread 452:24 0.00% named
1019 root 1 4 -15 6172K 1332K sbwait 279:27 0.00% perl
Thank you,
--
Bart
|
8/16/2010 11:05:04 AM
|
1
|
Bart Van der Donck <bvdd1...@gmail.com>
|
Reformatting an ASCII file
I have an ASCII file with a large number of lines. Each line has
the following structure:
1) An alphanumeric string starting at column 0 and up to 20
characters in length.
2) A sequence of 10 space characters starting at the column where
the alphanumeric string above ended.
3) An alphanumeric string starting at the column where the
sequence of space characters above ended.
I want to change this so that the number of space characters
between the alphanumeric strings above is variable, in such a way that
all the alphanumeric strings mentioned in 3 start exactly at th
|
8/15/2010 8:17:43 PM
|
5
|
Clark Smith <noaddr...@nowhere.net>
|
speeding up a slow script
I have a 24-line bash script that runs much too slowly. It may not be
possible to improve too much but I'm hoping that you all have some
great ideas.
The script is dedicated to the simple task of creating MD5s for each
file in a hierarchy via a daily cron call. In the loop in which the
files are processed, any number of directories or files may be
excluded and it is this exclude portion of the script which I suspect
probably slows down the script the most.
On the test hierarchy, there are 4,393 files and 359 subdirectories.
The script took 15:40 to process that hierarchy which,
|
8/14/2010 10:56:44 PM
|
5
|
Jack Shown <jacksh...@gmail.com>
|
search uid
I want to serach in a directory and all sub-directories if a UID exits
that has 452.
How can I do that?
|
8/13/2010 7:15:13 PM
|
0
|
rvaede <rvaede...@gmail.com>
|
copy and comp commands
I'm trying to remember what commands are available for comparing and
updating directories on multiple machines. I'm thinking rcomp or
xcomp and something like xcopy but can't find anything. Sux getting
old....
thx
|
8/13/2010 2:58:39 PM
|
1
|
jimmy <bigtoeh...@hotmail.com>
|
awk script to split text file content to multiple files
I have an input text file like this.
------------------------
DEFINE QLOCAL ('Q1') +
... number of lines
...
REPLACE
DEFINE QLOCAL ('Q2') +
... number of lines
...
REPLACE
DEFINE QALIAS ('A1') +
... number of lines
...
REPLACE
DEFINE QALIAS ('A2') +
... number of lines
...
REPLACE
------------------------
The input file contains other definitions as well, such as
QREMOTE, LISTENER, etc. But I use the above for the sake
of simplicity.
I want to split the conent of this input fil
|
8/12/2010 10:19:08 PM
|
1
|
Harry <harryooopot...@hotmail.com>
|
gnu-make prerequisites
For a given makefile, how to list the pre-requisites for a particular
target without modifying the makefile?
TIA
-jl
|
8/12/2010 8:56:37 PM
|
1
|
James <hslee...@yahoo.com>
|
ERR trap
Suppose I want to bail out of a script if any command exits with a
non-zero status. AND, I want to know what line caused the problem.
set -e
will do it, but who knows what line aborted?
trap 'echo $LINENO' ERR
doesn't help either, because it reports the trap line, not what caused
the trap.
--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
|
8/12/2010 8:27:24 PM
|
10
|
John Kelly <...@isp2dial.com>
|
download basics
is there a way to tell lynx or somebody to execute something like
http://www.vim.org/scripts/download_script.php?src_id=12904
so that bufexplorer.zip winds up somewhere i can find it?
wget doesn't understand what to do with php, or something
any help will be appreciated
|
8/12/2010 7:22:51 AM
|
1
|
sc <nos...@spamhaters.com>
|
vi key bindings
in the output of bind -P
what does
beginning-of-line can be found on "M-OH", "M-[H"
precisely which key sequences are these?
M-OH", "M-[H"
|
8/12/2010 6:44:33 AM
|
2
|
Paul Branon <paulbra...@googlemail.com>
|
hostname and DNS
What makes /bin/hostname use an old DNS name instead of the name that /
usr/bin/dig displays? I have a script which uses $( hostname -s ) to
obtain the hostname. Even though the DNS update was done at least a
month ago, /bin/hostname continues to provide the name that I don't
want. I also have the hostname defined properly in /etc/hosts.
Should I mention it to the DNS admin or is there some way to force
getting the correct name?
|
8/11/2010 6:40:58 PM
|
5
|
Lao Ming <laoming...@gmail.com>
|
Search for 2 strings
Hi
I have a file containing 2 words on 2 seperate lines:
e.g.
car
bike
I want to pipe this file through sed or awk, and only return the
output only **both** words are found. Could someone help me do this?
As they are on different lines grep wont work.
Thanks
|
8/11/2010 5:26:47 PM
|
5
|
Chris <cconnel...@lycos.com>
|
ssh and passing second arguments through awk
All
bash-2.03$ cat /tmp/output/1settmp
192.168.112.14 192.168.4.14
192.168.112.16 192.168.4.16
I have entries like the above in the file /tmp/output/1settmp
In the above file I have to take the first column entry(IP) and ssh
into that and has to ping the corresponding second column ip
Wrote a script like this
while read line; do echo $line | ssh -t `awk '{print $1}'` -l user "/
bin/ping -c 4 `awk '{print $2}`"; done < /tmp/output/1settmp
also this one
while read line; do echo $line | ssh -t `cut -d' ' -f1` -l user "/bin/
ping -c 4 `cut -d' ' -f2`"; done < /tmp/outpu
|
8/11/2010 5:06:53 PM
|
4
|
K K <mail2rkart...@gmail.com>
|
sed and quoting issue
Hello,
I'd like to execute it:
sed -e "s#\(^\.INCLUDE[ \t]*\"\).*\(noMisMatch\)#\1$MODEL_DIR\2#g"
totoFile > titiFile
The problem is coming from \" which generate an error.
The first pattern i would like to catch is: .INCLUDE " which is in
regexp \(^\.INCLUDE[ \t]*\"\), but " is generated problem with sed
if i use single quote like this
sed -e 's#\(^\.INCLUDE[ \t]*\"\).*\(noMisMatch\)#\1${MODEL_DIR}\2#g'
totoFile > titiFile
I do not have problem to catch " but the $MODEL_DIR is not substitute
by the righ value.
can yoiu help me.
regards,
fabrice
|
8/11/2010 12:08:01 PM
|
7
|
trighole <fabrice.bernardgran...@gmail.com>
|
$RANDOM
Interix has no "mktemp -d" utility.
I could loop a "mkdir /tmp/$RANDOM" until I find a directory name not
already taken, but I'd rather have some alpha characters in the string,
like "mktemp -d" produces.
So I thought of reading a few characters from /dev/urandom to get what I
want. But I wonder, is /dev/urandom available on most platforms?
Or perhaps take a value from $RANDOM and use it as a seed to a string
randomizing function. Anybody already written something like that?
--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php
|
8/10/2010 11:57:06 PM
|
23
|
John Kelly <...@isp2dial.com>
|
removing files
I have a folder with a bunch of sub folders.
I am trying to run a script to remove all the files in the folders and
sub folders.
I don not want to remove the directories.
|
8/10/2010 7:09:05 PM
|
1
|
rvaede <rvaede...@gmail.com>
|