Reputation: 349
I need some help. I have a text file and within it, I have an output from a TFS command (tfhistory):
Changeset: 74125 User: JDoe Date: Thursday, August 30, 2012 3:56:06 PM
Comment: Task # 12345. JDoe.
Items:
merge, edit $/Project Name/FolderSln/Folder1/Binary.File1.cs
merge, edit $/Project Name/Folder1/Folder2/SQL_File2.sql
merge, edit $/Project Name/Folder1/Folder2/Folder3/File3.png
Check-in Notes: Code Reviewer: Performance Reviewer: Security Reviewer:
My objective is to filter all the junk from the file and only keep the list of files, in the example above, the output would be below. However, for CS files, we would be able to copy the dll instead of the file
Folder1.dll
SQL_File2.sql
File3.png
How can I achieve this considering there may be multiple change set sections with multiple files and file paths may be different?
I was thinking it would be possible to isolate the lines with a GREP or FINDSTR command to extract the file paths only, and then create a small application that uses an array to extract the file names and publish them to a different text file.
$/Project Name/Folder1/Binary.File1.cs
$/Project Name/Folder1/Folder2/SQL_File2.sql
$/Project Name/Folder1/Folder2/Folder3/File3.png
Upvotes: 0
Views: 333
Reputation: 42494
assuming your output of tf history is in as file call tf.list, this batch will produce the desired result:
for /F "delims=$ tokens=1,*" %%a in (tf.list) do if NOT !%%b!==!! call :line "%%b"
goto :eof
:line
set filename=%~n1%~x1
echo %filename%
goto :eof
Upvotes: 1