Could you pls explain me how your code works. Its not working in my machine.I got the output as below.
> while read a; do echo -n "$a "; done < input.txt
-n I have a
-n pen and
-n notebook.
More over my input file is like below.
I have a
pen and
notebook.
I have a
pen and
notebook.
Like this it is repeating with two blank lines in the middle.
what i want is
I have a pen and notebook.
I have a pen and notebook.
cat FILE
I have a
pen and
notebook.
I have a
pen and
notebook.
~
perl -00 -pe 's/\n/ /g; s/ $/\n/' FILE
I have a pen and notebook.
I have a pen and notebook.