Is it possible to read a text file and replace a character or strings and save it in a new file using CasperJs? I tried searching a lot but I can only find reading and writing data in text files...
My main aim is to fetch some text and store it in json file, but the problem is I am getting \n
with the text.
I can fetch the text and store it in a json file, but to remove that \n
character, I thought of opening that file and replace "\n"
with null
.
text to be fetched:
hello
abc
I am using these commands:
var a = this.fetchText({type: 'xpath', path: 'tr5'});
this.echo(JSON.stringify(a));
Output:
hello\n
abc
and I don't want this \n
character. I want to print "hello"
and "abc"
in same line.
Expected:
hello abc
Please help me with the code.