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)...
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.