i have a simple text file as input.i have to print that file in paragraph format.whenevr it finds "\n" in the input text it should start printing in next paragraph in output file.also a fixed amount of space should be given before start writing in every paragraph.
the input and output file format are attached below...
pls provide a unix ar perl script to do this...
Hi Avik. What you require is a program that replaces each instance of \n with \n\n. This could easily be done in Perl, but is so simple it would be neater to use sed. Seeing as you said a Unix script would be OK I'll assume you've got sed on your system and that you're in fact using a Unix system. In this case type the following into the shell:
sed 's/\\n/\\n\\n/gw /path_to_file/new_file.txt' <good.txt
To add spaces before the start of each paragraph just add them to the end of the regex (between the first // block). If a mod reads this feel free to move it to the Unix scripts forum. I hope this helps.