Thanks everyone for the info. I will be implementing this week, and I will let you know how it went. On Sun, Jan 23, 2011 at 11:26 PM, De DBA <dedba@xxxxxxxxxx> wrote: > I don't know if this is already answered or not, excuse me if it is. > > As a Perl nut, I do believe that there's something to say for using sed to > do stream editing, nothing laughable about that ;) . To complete the sed > command: > > sed -e 's/[\ \t]*|/|/g' \ > -e 's/|[\ \t]*/|/g' \ > -e 's/^[\ \t]*//' \ > -e 's/[\ \t]*$//' > > Note there is an escaped space (\ ) before the escaped t (tab - \t ). This > will strip whitespace (excluding newlines) from the beginning and end of > each column, including leading and trailing columns. If you use a sql script > you can easily incorporate it as: > > sqlplus -s / @my.script | sed -e 's/[\ \t]*|/|/g' -e 's/|[\ \t]*/|/g' -e > 's/^[\ \t]*//' -e 's/[\ \t]*$//' > > Cheers, > Tony > > > Andrew Kerber wrote: > >> Well, the trouble is I do actually need a delimiter there, I am using set >> colsep '|' so I have a pipe delimiter. If there was a way to trim the data >> before the column separator it would be nice, but I couldnt figure out any >> way to do it. I ended up using a sed command to trim the resulting output >> that seems to work. >> >> sed 's# *|#|#g' infile.csv | sed 's/|[ ]*/|/g' > output.txt >> >> Probably a real sed guru wouldnt need the pipe, and no doubt a perl guy >> would laugh at this, but it gets the job done for a guy whose primary >> Unix/Linux experience comes from having to figure stuff out from the dba >> point of view. >> >> >> >> On Wed, Jan 19, 2011 at 10:13 AM, <Joel.Patterson@xxxxxxxxxxx <mailto: >> Joel.Patterson@xxxxxxxxxxx>> wrote: >> >> <snip> >> > > > > > -- > //www.freelists.org/webpage/oracle-l > > > -- Andrew W. Kerber 'If at first you dont succeed, dont take up skydiving.'