Unfortunately, for Import-CSV
delimiters can only be one character long. This leaves you with two options. First is to use string parsing on the file to get down to one delimiter.
(Get-Content C:\path\to\file\PageLog.txt) -replace "`t`t","`t" | Out-File C:\path\to\file\PageLog.temp.txt
Import-Csv C:\path\to\file\PageLog.temp.txt -Delimiter "`t" | Export-Csv C:\path\to\file\PageLog.csv -NoTypeInformation
In this method you could skip the import/export and just replace with a comma.
(Get-Content C:\path\to\file\PageLog.txt) -replace "`t`t",',' | Out-File C:\path\to\file\PageLog.temp.txt
Otherwise you could import the csv with extra columns and filter. As iRon suggests, if you only have one extra column you can simply exclude it:
Import-Csv C:\path\to\file\PageLog.txt -Delimiter "`t" |
Select-Object * -ExcludeProperty H1 |
Export-Csv C:\path\to\file\PageLog.csv -NoTypeInformation
If you have multiples, Select-Object
supports wildcards so you could use -ExcludeProperty H*
with the assumption that none of your other columns started with H
.
Otherwise you could get use a regex against the column names.
$CSV = Import-Csv C:\path\to\file\PageLog.txt -Delimiter "`t"
$GoodColumns = $CSV |
Get-Member -MemberType NoteProperty |
Where-Object {$_.name -notmatch '^H\d+$'} |
Select-Object -ExpandProperty Name
$CSV | Select-Object $GoodColumns | Export-Csv C:\path\to\file\PageLog.csv -NoTypeInformation