1

私はいくつかのテキストファイルを解析しようとしましたが、最後に2行から1行を作成する必要があります。

19.10.2012 15:33:22<TAB here!>
textline<TAB here!>#1
19.10.2012 15:33:13<TAB here!>
textline<TAB here!>#2
19.10.2012 15:29:29<TAB here!>
textline<TAB here!>#3
19.10.2012 15:29:23<TAB here!>
textline<TAB here!>#4

出力で私はこれを持っている必要があります:

19.10.2012 15:33:22<TAB here!>textline<TAB here!>#1
19.10.2012 15:33:13<TAB here!>textline<TAB here!>#2
19.10.2012 15:29:29<TAB here!>textline<TAB here!>#3
19.10.2012 15:29:23<TAB here!>textline<TAB here!>#4

お願い助けて!:)

編集:これは私が持っているものです:

Get-ChildItem $Path -Recurse -Include *.* | Foreach-Object {$_.FullName} |
Foreach-Object {
    Write-Host $_
    $Item = Get-Item $_
        (Get-Content $_ -ReadCount 2 -Encoding UTF8) | Foreach-Object {
        (-join $_)}} | Set-Content $Item -Encoding UTF8
4

2 に答える 2

3
Get-Content test.txt -ReadCount 2 | 
Foreach-Object { (-join $_) -replace '<TAB here!>',"`t" }
于 2012-10-23T14:38:04.403 に答える
0

一方通行:

$g = @()
$a = gc .\yourTXTfile.txt

for ($i=0; $i -lt $a.count ; $i+=2)
{ $g += $a[$i]+$a[$i+1] }

$g | set-content .\yournewTXTfile.txt
于 2012-10-23T14:25:28.510 に答える