Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 10777

Powershell - keep only lines in txt files contain some selected words

$
0
0

I have a txt file and I would like to keep only a few lines in it

I want to a command that turns this

txt file:

;FFMETADATA1title=TNTdisc=01comment=lyrics-eng=\\\album=Classicgenre=Olderartist=ACDCencoder=Lavf59.17.102

Into this:

;FFMETADATA1title=TNTencoder=Lavf59.17.102

I used the command in this link:

Keep only lines in txt files that contain a certain word/character (Powershell) (Windows batch file)

PowerShell -Command "gci *.txt | foreach { (cat $_.FullName | ? { $_ -like '*;FFMETADATA1*' }) | set-content $_.FullName}"

But the txt file looked like this:

;FFMETADATA1

How to use the command to make the txt file have lines ;FFMETADATA1 title= and encoder= ?


Viewing all articles
Browse latest Browse all 10777

Trending Articles