ladies, gents..
say i have a file that should have 10 fields... (9 delimiters)
some records have 10 fields, some have 5 some have 8, etc.. nothing consistent, but i need my file to have 9 delimiters on each line, even if its null fields..
how can i go line by line and add the correct # of delimiters if they are missing..
i have a dirty way... but looking for help on a more elegant solution...
thanks
my ugly way... works fine on small stuff.. but when you have 100's of files, ranging in size from 10 -200 fields.. its just not practical
this example... i expect 4 delimiters on each line...
(i dont need to substitute the delimiters, just used the 1's for ease of reading)
$ cat test.txt
a1b1c1
a1b
a1b1c1
cat test.txt | awk -F1 '{print $1 "|" $2 "|" $3 "|" $4}'
a|b|c|
a|b||
a|b|c|
thanks in advance..
ob