$ perl -ne ' chomp; chop; my@arr=split(); print $arr[0], "\t", $arr[2], "\n";' sharan.txt \ | psql -d test -c " /* drop table if exists sharan_txt; */ create table sharan_txt(col1 text, col2 text); copy sharan_txt from stdin csv delimiter E'\t'; "