Shell script
    Jason Clinton 
    me at jasonclinton.com
       
    Wed Nov 12 02:33:00 CST 2003
    
    
  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jason Clinton wrote:
| brad wrote:
|
| | I have a tab delimited list of usernames and passwords that I need to
| | run a set of system commands on.  I was thinking maybe I could build a
| | for loop and assign the first entry on the line as $x and the second
| | entry on the line as $y.  Is this possible?  Or am I going to have to
| | use sed or awk?
|
| You can enter this at the command line if the Ruby interpreter is
| installed:
|
| ruby -e "File.open("sourcefile").each_line { |line| system("command | #{$1} #{$2}") if 
/(.*)t(.*)/=~line }"
Actually, it can be much shorter:
$  ruby -ne 'system("command #$1 #$2") if /(.*)t(.*)/' sourcefile
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQE/sY3GtSqjk42zvwkRAs6SAKCcDspxpDvYxYoAG5vfT9pwvBTfgQCfdGi5
Ll2gSSebn4UihGlGw2IqtDw=
=ZyLE
-----END PGP SIGNATURE-----
    
    
More information about the Kclug
mailing list