Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by entrylevel

  1. entrylevel

    want to use awk for this

    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!
  2. entrylevel

    newbie question, exec shell command in perl

    ooh, I see your point, there is an option that I omitted, should be smbpasswd -U uid, thanks.
  3. entrylevel

    newbie question, exec shell command in perl

    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...
  4. entrylevel

    newbie question, exec shell command in perl

    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.
  5. entrylevel

    newbie question, exec shell command in perl

    :) 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.
  6. entrylevel

    newbie question, exec shell command in perl

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

    newbie question, exec shell command in perl

    Thanks for the post. one more question, how can I get rid of the output in perl? thanks.
  8. entrylevel

    newbie question, exec shell command in perl

    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 ")...
  9. entrylevel

    find difference between two files (added, removed, changed)

    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...
  10. entrylevel

    find difference between two files (added, removed, changed)

    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] =...
  11. entrylevel

    find difference between two files (added, removed, changed)

    Hi xmb, sorry, nawk works. thanks. Regards!
  12. entrylevel

    find difference between two files (added, removed, changed)

    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...
  13. entrylevel

    find difference between two files (added, removed, changed)

    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"}...
  14. entrylevel

    find difference between two files (added, removed, changed)

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

Part and Inventory Search

Back
Top