Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.28 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Preprocessor to include file
  2. cat prog | ruby -pe 'gsub /{{{.+}}}/, File.open("$0").read'
  3.        
  4. cat prog | ruby -pe '$_.gsub!(/{{{(.+?)}}}/) { File.read $1 }'
  5.        
  6. cat prog |  ruby -ne 'puts $_.gsub(/{{{(.+?)}}}/) {  File.read $1 }'
  7.        
  8. s.gsub(/{{{(.+?)}}}/) { |m| File.read($1) }