Search Results

Search: Posts Made By: hfreyer
3,317
Posted By hfreyer
From Spreadsheet::WriteExcel perldoc page
From Spreadsheet::WriteExcel perldoc page
4,811
Posted By hfreyer
Here is a try in perl (works for more than two...
Here is a try in perl (works for more than two input files, too):
Save code as comb.pl and call with: perl comb.pl input1 input2 ...
#!/usr/bin/perl
exit if $#ARGV < 0;
for ($i=0; $i<=$#ARGV;...
10,458
Posted By hfreyer
You need to retain the output until the end and...
You need to retain the output until the end and reset it at every match.
Here is a sample code, though not very elegant:
nawk...
1,055
Posted By hfreyer
Hi aish11, do you have a per-line loop around...
Hi aish11,
do you have a per-line loop around this like "while(<>)" or one the command line parameter "-n" or "-p" ?
In this case the variable $runDate gets updated in each line. Is it used later ?...
10,566
Posted By hfreyer
This would lead to an endless loop. Possibly...
This would lead to an endless loop. Possibly there is a system-wide profile /.profile. You might try this:
[[ -r /.profile ]] && . /.profile
set -o vi
PS1=$
5,249
Posted By hfreyer
You might extend the file number's digits (4...
You might extend the file number's digits (4 digits in the example, increase if needed):
awk '/HELLO/{istr=sprintf("%04d",i++)}{print > "file"istr}' input.txt
3,037
Posted By hfreyer
Possibly something like this: cat yourfile |...
Possibly something like this:
cat yourfile | perl -n -e 'chomp; if(m/^\s*(\D+)\s*(\d+)\s+Uniprot Id\s+(\d+)/){printf("%s for %s %s\n",$3,$1,$2)}' > outfile
2,416
Posted By hfreyer
So simply use awk -F" " -vOFS=" "...
So simply use
awk -F" " -vOFS=" " '{a[$1]+=$2}END{for (i in a) print i,a[i]}' a.txt
13,188
Posted By hfreyer
prompt> tclsh % set str "scmid1_scmid2" ...
prompt> tclsh
% set str "scmid1_scmid2"
scmid1_scmid2
% set lst [split $str "_"]
scmid1 scmid2
% puts [llength $lst]
2
% puts [lindex $lst 0]
scmid1
% puts [lindex $lst 1]
scmid2
7,720
Posted By hfreyer
Don't worry about CPU time. The script will be...
Don't worry about CPU time. The script will be >99% of the time in "sleep",
which won't consume CPU time. Still have to think about the other point.
7,720
Posted By hfreyer
Hi solaris_1977, how do you wish to control the...
Hi solaris_1977,
how do you wish to control the termination of the script ? kill ? run for some period ?
To run it permanently on a remote server, you may start it like this:
nohup /path/to/script...
7,720
Posted By hfreyer
This script will also mail the names of...
This script will also mail the names of deleted/added users, but does not catch other changes:

#!/bin/bash
ME=myusername@mymailhost
ulistorig=( `cut -d: -f1 /etc/passwd | sort` )...
2,880
Posted By hfreyer
as DGPicket said: Use "grep -l" find . -name...
as DGPicket said: Use "grep -l"
find . -name \*.txt | xargs grep -l "string"
4,793
Posted By hfreyer
IMO you need an equal sign between variable name...
IMO you need an equal sign between variable name and value:
ssh -o 'PasswordAuthentication=yes' -o 'PreferredAuthentications=publickey'
1,813
Posted By hfreyer
Seems a bit strange, but you might try this if...
Seems a bit strange, but you might try this if you need a command line after the command:
--command="bash -c 'ls -ltr; bash'"
1,099
Posted By hfreyer
You might capture the hostname immediately from...
You might capture the hostname immediately from the first prompt:
set promptre {root@(.*?) *\#}
expect {
...
-re "$promptre" {
set hostname $expect_out(1,string)
}
......
10,443
Posted By hfreyer
Can't confirm statement 3. of Chubler_XL. I'm...
Can't confirm statement 3. of Chubler_XL. I'm using expect for ssh connections.
One might think of extending the expect command to handle the ssh login state machine,
e.g. something like this:

...
5,097
Posted By hfreyer
Although you did not mention that something went...
Although you did not mention that something went wrong I suppose that
your script has problems with the eval statement, which expects a shell command
instead of a script filename. You may try...
2,300
Posted By hfreyer
Sorry, you need to replace the "exit" by "break":...
Sorry, you need to replace the "exit" by "break":
if [ y -eq $count ]
then
break
fi
11,182
Posted By hfreyer
I'm not sure, but possibly the "$" is taken in...
I'm not sure, but possibly the "$" is taken in some special meaning. Try
expect -ex "\$"
In any case you may get more insight into the script's operation by adding
exp_internal 1
at the beginning
3,123
Posted By hfreyer
Some time ago I wrote a script "fmail" which uses...
Some time ago I wrote a script "fmail" which uses mailx program and is
able to write simple text mails as well as sending attachments, too.
Maybe you can make some use out of it. After starting the...
6,819
Posted By hfreyer
The parse error comes from "bc". The script...
The parse error comes from "bc". The script executes
echo ' 6.7% us > 6.0% us 6.1% us 6.2% us 6.3% us 6.5% us 6.6% us 6.7% us 6.8% us 6.9% us 7.0% us' | bcwhich is not a correct input for "bc". On...
2,300
Posted By hfreyer
Possibly something like this: #!/bin/ksh let...
Possibly something like this:
#!/bin/ksh
let x=0
let y=0
let count=$1
let size=$2
first=1
for dev in `cat /opt/emc/scripts/bin/noport-devs`
do
if [[ "$dev" > "$start" ]]
...
1,709
Posted By hfreyer
while (<>) { chomp; split; foreach $i...
while (<>) {
chomp; split;
foreach $i (@_) {
...
}
}
If you want to get more familiar with perl, in any case it is recommendable to study the man pages (which in case of perl are very...
2,938
Posted By hfreyer
You are mixing syntax of csh with sh/bash...
You are mixing syntax of csh with sh/bash elements.
Exclamation marks in strings need to be escaped because of their special meaning in csh.
#!/bin/csh
set users = (user1 user2 user3)
echo The...
Showing results 1 to 25 of 39

 
All times are GMT -4. The time now is 08:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy