Hi, I am trying to capture all paths in a text file. for that i am splitting the string into an array and the word with /java to get the paths.
Here is my ruby code *logfile = "/home/weblogic/javaapp.txt"* *log = Facter::Util::FileRead.read(logfile)* *log.each_line do |line|* *unless log.nil?* *log.each_line do |line|* * val = line.split(/ /)* * java_path = val.grep(%r!/java!)* * java_count += 1* *Facter.add("java_known_weblogic_version#{java_count}") do* * setcode do* * java_path* end end Here is my text file */u01/java/jdk1.7.0_72/jre/bin/java* */u01/java/jdk1.7.0_72/bin/java* */u01/java/jdk1.7.0_65/jre/bin/java* */u01/java/jdk1.7.0_65/bin/java* The facts are returning like this java_known_weblogic_version1["/u01/java/jdk1.7.0_72/jre/bin/java\n"] java_known_weblogic_version10[]java_known_weblogic_version11[] java_known_weblogic_version12[]java_known_weblogic_version13 ["/u01/java/jdk1.7.0_65/bin/java\n"]java_known_weblogic_version14[] java_known_weblogic_version15[] My question how to eliminate these [] and need to return only path /u01/java/jdk1.7.0_65/bin/java? Anyone please help me -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/03b20b9c-a766-4f52-be6b-e2b64593d304%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.