On Nov 18, 2004, at 11:53 AM, Adam Witney wrote:
Hi,
Is it possible for the COPY command to read data from a file, but skip specific columns?
You can use awk to skip fields and create an intermediate file or better yet, just pipe the output to copy. Here is a trivial example:
awk '{ FS = "\t" ; OFS = "\t" ; print $1,$3 }' inputdatafile
This sets the input and output field separators to tab and outputs the first and third fields from inputdatafile. If you want to skip the first record just add the following if statement:
awk '{ FS = "\t" ; OFS = "\t" ; if ( NR > 1 ) print $1,$3 }' inputdatafile
Patrick B. Kelly ------------------------------------------------------ http://patrickbkelly.org
---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx