Created
December 15, 2010 13:22
-
-
Save gildo/741934 to your computer and use it in GitHub Desktop.
Joins files by regex matching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# v0.1 - initial import | |
# | |
# Description: | |
# | |
# Joins all files matched into one single file | |
# | |
# Usage: | |
# | |
# ruby jony.rb 2x21 | |
# | |
# Author: Ermenegildo Fiorito <fiorito.g@gmail.com> | |
# | |
# Licese: AGPL (GNU Affero General Public License)[http://www.gnu.org/licenses/agpl-3.0.txt] | |
# | |
abort "No args :(, please insert a matcher" if ARGV[0].nil? | |
(a=Dir["**"].grep(/#{ARGV[0]}/)[0])[-4..-1]="" | |
puts "joinin' #{a}" | |
system("cat #{a}* > #{a}") | |
Dir[a].nil?? "Good!, no errors" : "Ooooops error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment