From: Asif Iqbal Date: 2009-08-07T01:47:37+09:00 Subject: how to read parse data from two file to generate one one file #!/usr/bin/ruby ARGF.each do |line| sunetid, tmp, uid, gid, name, homedir, shell = line.split(/\:/) puts " user { \"" + sunetid + "\":" puts " ensure => \"present\"," puts " uid => \"" + uid + "\"," puts " gid => \"" + gid + "\"," puts " comment => \"" + name + "\"," puts " home => \"" + homedir + "\"," puts " shell => \"" + shell.chomp + "\"," puts " }" puts "" end This file take the a password file and generate some output per user. How do I feed it passwd and shadow files and generate a file per user with another key => value like password => 'hashkey from shadow' along with the key => value then it already generates? So instead of the current output like user { "dbbkp": ensure => "present", uid => "12346", gid => "70006", comment => "DB Backup User - See rsync in cron", home => "/home/dbbkp", shell => "/usr/local/bin/bash", } I want it to generate an output like this user { "dbbkp": ensure => "present", uid => "12346", gid => "70006", shadow => "iaUGiJld2XMKM" # it will get that value from shadow file comment => "DB Backup User - See rsync in cron", home => "/home/dbbkp", shell => "/usr/local/bin/bash", } here passwd file entry looks like this dbbkp:x:12346:70006:DB Backup User - See rsync in cron:/home/dbbkp:/usr/local/bin/bash and shadow file entry looks like this dbbkp:iaUGiJld2XMKM::::::: Thanks for the help -- Asif Iqbal PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?