Guest User

Untitled

a guest
Jul 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. input{ch1.tex}
  2. input{ch2.tex}
  3. ...
  4.  
  5. $ cat file1.txt
  6. foo
  7. bar
  8. qweinput{file2.txt}asdinput{file3.txt}zxc
  9. baz
  10. $ cat file2.txt
  11. qux
  12. quux
  13. quuux
  14. $ cat file3.txt
  15. xyzzy
  16. xyzzzy
  17.  
  18. $ <file1.txt perl -pe 's/\input{([^}]*)}/open $1,"<$1";join("",<$1>)/ge'
  19. foo
  20. bar
  21. qwequx
  22. quux
  23. quuux
  24. asdxyzzy
  25. xyzzzy
  26. zxc
  27. baz
  28.  
  29. gawk '
  30. match($0, /\input{([^}]+)/, a) {
  31. system("cat " a[1])
  32. next
  33. }
  34. {print}
  35. '
Add Comment
Please, Sign In to add comment