Advertisement
gewur33

README

Dec 29th, 2014
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.92 KB | None | 0 0
  1. ##################################################################
  2. ##
  3. ##    USAGE & README
  4. ##
  5. ##################################################################
  6.  
  7. # e.g. we have 3 files *.txt jules.txt, jules2.txt jules3.txt in the directory "jules":
  8.  
  9. f00@localhost ~$ cd jules/
  10. f00@localhost jules$ ls
  11. jules2.txt  jules3.txt  jules.pl  jules.txt
  12.  
  13. # there are different ways of having the jules.pl script having all this files parsed.
  14. # either one can make them all into one, or one can call jules.pl on each of them
  15.  
  16. # first way is using only FIND to list all files named *.txt and then execute the code "perl jules.pl" for each of these:
  17.  
  18. f00@localhost jules$ find . -name "*.txt" -exec perl jules.pl {} \;
  19. 1.1.2003 4
  20. 2.4.2085 7
  21. 2.1.2054 6
  22. 2.1.2054 6
  23. 2.1.2054 6
  24. 2.1.2054 6
  25. 1.1.2003 4
  26. 2.4.2085 7
  27. 2.1.2054 6
  28. 2.1.2054 6
  29. 2.1.2054 6
  30. 2.1.2054 6
  31. 1.1.2003 4
  32. 2.4.2085 7
  33. 2.1.2054 6
  34. 2.1.2054 6
  35. 2.1.2054 6
  36. 2.1.2054 6
  37.  
  38. # works
  39.  
  40. # we could also make them all into one new file: "all.all" first and have the formated output into the file "result.res":
  41. # warning: i named the files all.all and result.res because all files ending with ".txt" in this directory will be used offcourse
  42.  
  43. f00@localhost jules$ find . -name "*.txt" | xargs cat >> all.all
  44. f00@localhost jules$ cat all.all
  45. 1.1.2003    4       2.4.2085    7       2.1.2054    6      
  46. 2.1.2054    6       2.1.2054    6       2.1.2054    6      
  47. 1.1.2003    4       2.4.2085    7       2.1.2054    6      
  48. 2.1.2054    6       2.1.2054    6       2.1.2054    6      
  49. 1.1.2003    4       2.4.2085    7       2.1.2054    6      
  50. 2.1.2054    6       2.1.2054    6       2.1.2054    6  
  51.  
  52. # ... and now call jules.pl on all.all to optain result.res
  53.  
  54. f00@localhost jules$ perl jules.pl all.all >> result.res
  55. f00@localhost jules$ cat result.res
  56. f00@localhost jules$ cat result.res
  57. 1.1.2003 4
  58. 2.4.2085 7
  59. 2.1.2054 6
  60. 2.1.2054 6
  61. 2.1.2054 6
  62. 2.1.2054 6
  63. 1.1.2003 4
  64. 2.4.2085 7
  65. 2.1.2054 6
  66. 2.1.2054 6
  67. 2.1.2054 6
  68. 2.1.2054 6
  69. 1.1.2003 4
  70. 2.4.2085 7
  71. 2.1.2054 6
  72. 2.1.2054 6
  73. 2.1.2054 6
  74. 2.1.2054 6
  75.  
  76. #works!!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement