-j b- wrote:
> I am working on a parser that allows the user to provide a delimiter as
> an argument to the script. However, I can not find a way to [elegantly]
> handle escaped characters (such as \t and \n).
> A simplified example to illustrate:
> 
> # Using
> s = ARGV.shift
> puts ['west', 'side', story'].join(s)
> 
> $ ./parse.rb '\t'
> => west\tside\tstory

It isn't a Ruby issue. It's a shell one. You need to find out how it's 
possible, in your shell, to specify those special characters. Are you 
using Linux? Bash?

$ echo one\ntwo
onentwo

$echo 'one\ntwo'
one\ntwo

$echo $'one\ntwo'
one
two

$echo 'one
two'
onw
two

$echo "one
two"
onw
two

So there are at least three ways to do \n in bash.
-- 
Posted via http://www.ruby-forum.com/.