Q: Ruby-Reading a specific bash-script file from ruby file #practice.rb
$TENANT=gets.chomp('/\p{Alnum}/')
$first = $TENANT.slice(0,1).capitalize
$second = $TENANT.slice(1..-1)
EXPORT_PASSWORD="Export-"+ $first + $second.chomp + "!"
EXPORT_FILENAME=$TENANT.chomp + ".xar"
file = File.open("/Users/..../input/exporttenant.rb", "r")
contents = file.read
puts content
output = File.open(/.../input/$TENANT.txt, "w")
$TENANT=tenant_name
file = File.open("/data/workday/wmu/input/exportTenant.properties", "r")
$line = file.readlines.select{|line| line.match('DS_ENTRY_OMS_SERVER')}
file.close
output=File.open("/data/workday/wmu/input/#{$TENANT}".chomp, 'w')
output.puts "TENANT_NAME=#{$TENANT}"
output.puts "EXPORT_PASSWORD=#{$PASSWORD}"
output.puts "EXPORT_FILENAME=#{FILENAME}"
output.puts "EXPORT_WITHOUT_TAR=N"
output.puts "BYPASS_BLOB=N"
output.puts $line
output.close
print "Export tenant created for the #{$TENANT}\n"

I have created one file by the name(wandarar.sh-written in bash).The wanda.sh file has commands.I want to run the wandarar.sh file from another file(practice.rb).
I want to include the same functionality what wandarar.sh file have into the practice.rb file.                                                                      How can I run this.Can someone help me with this ?

A: Basically, you are getting an array, select a line which is matched your criteria. 
file = File.open('/home/username/Documents/file.txt', 'r')

   puts file.readlines.select{|line| line.match('DS_ENTRY')}

file.close


A: I think what you are looking for is the .grep method, try this:
file_name = "put your file name here"
lines = File.readlines(file_name)
lines.grep(/DS_ENTRY\((.*)\)/)

File.open($1, "w") { |f| f.puts "file content" }

