From: Joel VanderWerf Date: 2008-10-27T03:48:09+09:00 Subject: Re: Join all text files in a folder, with a single line of Ruby code Nobuyoshi Nakada wrote: > Hi, > > At Sun, 26 Oct 2008 04:08:48 +0900, > Joel VanderWerf wrote in [ruby-talk:318574]: >>> ruby -e"puts ARGF.to_a" *.txt >merged >> Cheating a bit: >> >> ARGV.replace Dir['*']; print ARGF.read >> >> Not recommended, though, since it reads all the data into memory and >> steps on ARGV. > > ruby -pe 'BEGIN{ARGV.replace Dir["*"]}' > Very nice! But if you are going that far, why not go all the way: ruby -pe'1' * -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407