ooh, gsub might be the solution, but is there a smart way to deal with 3 files something like use NR==FNR to process lines from 2 files. Thanks.
Regards!
everybody can execute the smbpasswd if I understood you correct.
the cgi script can be run successfully, just after adding this part (which can be used in the shell), nothing happened to samba password, the script just skipped this part, so i m thinking maybe there is different way to write it...
plus, when I call this function in a perl cgi script, it seems "print" and EOF do not work from there. how can I accomplish the same function in a cgi script not run directly from shell. Thanks.
:) just realized I could do it that way. Thanks.
above code, if I declear $oldpasswd, $newpasswd, $verifypasswd outside of function changesmbpasswd, how can I pass the value into this function? still newbie, I know.
in shell i can use redirect to /dev/null and there is no output, but in perl
#!/usr/bin/perl -w
use strict;
sub changesmbpasswd {
my $oldpasswd = "oldpass";
my $newpasswd = "newpass";
my $verifypasswd = "newpass";
open (PROG, "|/usr/local/samba/bin/smbpasswd -s") or die ("can't open...
in shell I can do
/usr/local/samba/bin/smbpasswd -s << EOF > /dev/null
$oldpasswd
$newpasswd
$verifypasswd
EOF
how to translate it to perl? simply add system seems does not work ...
system ("/usr/local/samba/bin/smbpasswd -s << EOF > /dev/null
$oldpasswd
$newpasswd
$verifypasswd
EOF
")...
thanks everybody PHV, futurelet and xmb, I learned a lot!
Regards!
FNR==NR {f1[$1]=$2;next}
{f2[$1]=$2}
END{
m=0
n=0
p=0
for(i in f1) if(!(i in f2))
m++
if(m>=1)
print "following lines have been removed"
for(i in f1) if(!(i in f2))
print i, f1[i]
for(i in f2) if(!(i in f1))
n++
if(n>=1)
print...
thanks for the details, I will put some time on above xmb's posts and study.
regarding the 2nd post from me,
file1 to array
fb[file1,FNR]=$1
fn[file1,$1]=$2
f1[$1]=$2
file2 to array
fb[file2,FNR]=$1
fn[file1,$1]=$2
f2[$1]=$2
it seems I cannot do in either way below
1.
NR==FNR {f1[$1] =...
Hi xmb,
Thanks for the post, I need some time to digest your code above, however, when I cut/paste the code and ran it ...
# awk -f awkf1 -v file=file1 file2
awk: syntax error near line 30
awk: illegal statement near line 30
awk: syntax error near line 32
awk: illegal statement near line 32...
I want to load these two files to arrays then compare them,
file1 to array
fb[file1,FNR]=$1
fn[file1,$1]=$2
f1[$1]=$2
file2 to array
fb[file2,FNR]=$1
fn[file1,$1]=$2
f2[$1]=$2
please let me know whether the flow below is possible to load everything or not. Thanks.
BEGIN {FS = OFS = "\t"}...
I read some of the posts here, but still could not come up a very good and smart logic for my case using awk
goal is to find difference between two files (the added lines, the removed lines and the changed lines) (first column are unique entries while 2nd column may contain duplicate entries)...
Hi KenCunningham,
Thanks for reply, I was NOT trying to login as root, and below are what I ve checked so far,
# netstat -an | grep '*.23' | grep LISTEN
*.23 *.* 0 0 24576 0 LISTEN
*.23 *.*...
Hi I got a problem on solaris 8 when using the telnet,
host1% telnet host2
Trying 138.123.128.144...
Connected to host2.cocome.com.
Escape character is '^]'.
SunOS 5.8
Connection to host2.cocome.com closed by foreign host.
It immediately disconnected,
checked all realated files that I...
Hi PH,
Tried what you suggested still got
foreach: No match
I think I should jump out of the mind with foreach, since I can do
> set testvar="`cat list | head -1`"
do you have a good idea on how to read from a file (each line) and assign it to a variable, that way will do it.
I know csh...
I have a file contains all the names that i need to create directories for,
> more list
align_c_i_fix_out_reg[9]:D.sp
add_408_40_g121:A.sp
align_c_i_fix_out_reg[10]:D.sp
align_g1851:A0.sp
in sh i can do with no problem
#!/bin/sh
for var in `cat list`
do
mkdir tmp/"$var"
done
in ksh i...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.