Take this:
To be or not to be,
that is the question.
Whether 'tis nobler in the mind
to suffer the slings and arrows or outrageous fortune
Assume further that I want to post those lines in a forum or mail them to a friend. Also, I do not like using the GUI to write; so, I compose my writings in a virtual terminal.
Now, if I simply cut and paste that text into the page window (that of the forum), most probably it will look bad formated. By this I mean I won't be seeing it as above. The reason is as I type in the terminal, I enter newlines whereas as one types in the editor window of a forum no newlines are inserted unless one presses <Enter>.
So, what do I do? I run
Code:
cat text_just_written.txt|tr '\n' ' '>text_just_written.stripped
stripping the file of all its newlines, not before intercalating a special mark ('[', left square bracket) where the are two consecutive newlines, as you will be able to see in the example above, between "that is the question." and "Whether 'tis nobler in the mind". Otherwise tr would make me lose that information.
As a final step, I edit *.stripped and replace '[' by two newlines, cut and paste and ... ready to send. This procedure involves a lot of work made by hand. And as at the same time I want to improve my script writing skills, I thought a script would be the best thing to do.
I look forward to have answered your question and and to listen to your criticisms. Also, I'm sending you a link to another post of mine, which has been replied by you, and propose to continue the discussion in that tread. In that post, you'll get a better idea about what I intend to do. The link:
http://www.linuxquestions.org/questi...5/#post4715764
Regards.