Hi All, I am a newbie to Shell scripting. I have a requirement to Delimit the file fields of a Input file having special characters and spaces with ";".
Input File
----------------------------------
Server Port
----------------------------------
Local 1001
-----------------------------------------
Name Country Count
-----------------------------------------
XXX Bermuda 999
Welcome to the forum; and: thanks for intuitively using code tags correctly!
Any preferred tools? As you didn't specify what to do with the dash lines, nor with the empty lines (one is suppressed, one is retained), try (exploiting a few of awk 's internals and defaults):
That dependes on if and how fields are separated uniquely. If there is any chance that fields are separated by just one single space, you're doomed. If there's ALWAYS multiple spaces separating fields, change the field separator to sth. like " +" .