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
Post a Comment