readfile.awk 267 B

123456789101112131415
  1. # readfile.awk --- read an entire file at once
  2. #
  3. # Original idea by Denis Shirokov, cosmogen@gmail.com, April 2013
  4. #
  5. function readfile(file, tmp, save_rs)
  6. {
  7. save_rs = RS
  8. RS = "^$"
  9. getline tmp < file
  10. close(file)
  11. RS = save_rs
  12. return tmp
  13. }