Search code examples
windowscommand-linezip7zip

Return specific fields from CMD


I need to clean my output log with specific fields in command line.

Current code returns all fields, log information in a txt file.

C:\Program Files\7-Zip>7z l "J:\FOLDER\FOLDER\*pattern*" > "C:\Users\me\Desktop\tst.txt"

Listing archive: PATH
Path = path_name
Type = zip
Physical Size = 0000011

Date Size Compressed Name ---- ----- ------- -----
01.07.2019 0 111 file_name 01.07.2019 0 111 file_name

I want my text output to return:

Date | Size | Compressed | Name 01.07.2019 0 111 name


Solution

  • @JosefZ saved the day.

    "C:\Program Files\7-Zip\7z" l "J:\FOLDER\FOLDER\*pattern*" | findstr /V /I "^$ ^7-zip ^Scanning ^Listing ^Path ^Type ^Physical ^Comment ^-- file,.*bytes files$ folders$ ^Archives ^Volumes ^Total"