I have two columns (fields) in my text file. I am trying to insert ‘|' between two and create an HTML table based upon the updated file. My sample input file
FOO This is a description
BAR Another description for bar
TEXT Another description for TEXT

So I ran awk '{ print $1 "|"; $1=""; print}' input > output but print command is adding a new line:
This is a description
Another description for bar
Another description for TEXT

Is there any way to tell awk not to print a newline and create the file? Here is what I want so that I can create final HTML table based upon ‘|‘:
FOO|This is a description
BAR|Another description for bar
TEXT|Another description for TEXT

[continue reading…]
I am a new Unix system user with a bash as a default shell. I can append text to a file using >> operator but how do I prepend a text to a file? I want the opposite operation of >>. How can I prepend some data to a text file? How do we add text to the beginning of a file in Bash under Linux?
[continue reading…]