remove duplicate from text file based upon column


i have text file has format , ends each line crlf. want remove dups file. found few examples seemed double file size when creating new file without dups and
seemed usable. take file use sql(dts) load text file table. want scrub text file before loading.

 

"test1"|"455"|"34166"|"06/23/11"
"test2"|"450"|"34167"|"06/23/11"
"test2"|"450"|"34167"|"06/23/11"

 thanks.

 

add out-file.

gc file.txt | sort -uniqu | out-file result.txt

or

gc file.txt | sort {$_.split("|")[2]} -unique | out-file result.txt



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file