谁能告诉我如何使用awk打印包括零的行号?
这是我的输入文件stackfile2.txt
当我运行下面的awk命令时,我得到actual_output.txt
awk '{print NR,$0}' stackfile2.txt | tr " ", "," > actual_output.txt
Run Code Online (Sandbox Code Playgroud)
而我的预期输出是file.txt
如何打印以零(0)开头的行号?
在阅读和试验 Stack Overflow 中的可用帖子后,我问了这个问题。
我正在努力在 powershell 中触发 MSTEST
这是我的尝试(显然是在堆栈溢出中可用的帖子的帮助下)
$testDLL = "C:\Automation\Tests\My.Tests.dll"
$fs = New-Object -ComObject Scripting.FileSystemObject
$f = $fs.GetFile("C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe")
$vstestPath = $f.shortpath
$arguments = " " + $testDLL + ' /TestCaseFilter:"TestCategory=FunctionalTests"'
Write-Host $arguments
& $vstestPath $arguments
Run Code Online (Sandbox Code Playgroud)
控制台输出:
PS C:\Users\myuser\Desktop\Powershell scripts> .\exp5.ps1
C:\Automation\Tests\My.Tests.dll /TestCaseFilter:"TestCategory=FunctionalTests"
Microsoft (R) Test Execution Command Line Tool Version 15.9.1
Copyright (c) Microsoft Corporation. All rights reserved.
VSTEST~1.EXE : The test source file "C:\Automation\Tests\My.Tests.dll /TestCaseFilter:TestCategory=FunctionalTests" provided was not found.
At C:\Users\myuser\Desktop\Powershell scripts\exp5.ps1:7 char:1 …Run Code Online (Sandbox Code Playgroud)