J
Jester Mania
Greetings,
I am new to Ruby and programming and am trying to parse a text file, but
encountered some difficulties.
Basically, the text file contains lines in the following format (where
\n is not really a newline but the text "\n"):
TextString [SYMBOL]\nDefinition
I need to replace the text \n with a tab, as I am attempting to separate
all the "tokens" by tabs. The issue here is that \n happens to be a
newline character. I tried searching the forums and tried the following
code:
lineItem = line.gsub("\\\\n", "\t")
but it doesn't seem to work and the \n is not being replaced. How can I
convert the \n text into a tab?
Any help is greatly appreciated!
I am new to Ruby and programming and am trying to parse a text file, but
encountered some difficulties.
Basically, the text file contains lines in the following format (where
\n is not really a newline but the text "\n"):
TextString [SYMBOL]\nDefinition
I need to replace the text \n with a tab, as I am attempting to separate
all the "tokens" by tabs. The issue here is that \n happens to be a
newline character. I tried searching the forums and tried the following
code:
lineItem = line.gsub("\\\\n", "\t")
but it doesn't seem to work and the \n is not being replaced. How can I
convert the \n text into a tab?
Any help is greatly appreciated!