Re: A "Load from" question.
Posted in 1998
Jonathan Leffler wrote: > On Mon, 28 Sep 1998, Suhas Tembe wrote: > > ab||cd --- line 1 > > |ab|cd --- line 2 > > ab|cd|| --- line 3 > > LOAD formats are more flexible than they used to be. Once upon not so > very long ago, the first two lines would have cause load errors with > no delimiter at the end of the third field. Yup, that one took me completely by surprise. Don't know when that happened. > Put spaces in the load file instead of leaving the fields empty: > > sed -e 's/^|/ |' \\ > -e 's/||/| |/g' \\ > -e 's/||/| |/g' \\ > -e 's/|$/| /' flat_file.txt > newfile Yup, except that the last command, which adds a space after the last | on the line, would have an unfortunate effect on the lines where there *is* a trailing delimiter. Then the load command would take it for a fourth data element, and give an error about the number of fields not matching the number of columns. June -- june_t@hotmail.com Lost in the wilds of Palo Alto, living on Peanut M&M's