$ cat sharan.txt apple <= banana; cat := dog; elephant <= flag; #### $ 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'; " #### $ psql -d test -c "select * from sharan_txt" col1 | col2 ----------+-------- apple | banana cat | dog elephant | flag (3 rows)