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:
FOO|
This is a description
BAR|
Another description for bar
TEXT|
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…]
awk
I would like to print filename with awk on Linux / Unix-like system. How do I print filename in BEGIN section of awk? Can I print the name of the current input file using gawk/awk?
[continue reading…]
[continue reading…]
I need to call the function called foo() using echo command in the same statement. How do I all or invoke the function using the echo statement?
[continue reading…]
How do I use awk pattern scanning and processing language under bash scripts? Can you provide a few examples?
[continue reading…]
[continue reading…]
How do I a print line after matching /regex/ using awk under Linux / UNIX operating systems? I’d like print the line immediately after a line that matches /regex/ but not the line that matches itself.
[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…]
[continue reading…]