我尝试解析一些文本文件,并在年底,我需要做1号线从2号线:PowerShell的 - 连接字符串
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
我不使用PowerShell,但[标签]在”查找/替换[回车]“会做到这一点。最简单的非自动化方式是在MS Word中打开文件,并用“^ t”替换“^ t^p”。大多数优秀的代码编辑器也接受正则表达式或接近等价。 linux/unix中的'sed'也很容易。 – Marc