mercredi 28 juillet 2021

powershell | select-string pattern + line unter the pattern

is there a way to select a string pattern, and get also the line after the pattern.

my metadata look like :

"t": "d",
      "n": "00001212",
        "22.06.2031",
        "",
        "",
        "batman",

my codeline looks like:

$contentNameFolder= $content__ | Select-String -Pattern '"n": * ' 

my output looks like :

"n": "00001212",

what i want to get is:

"n": "00001212",
        "22.06.2031",

i was trying to add into my code -context 1,2 or something like that but this dont worked for me.

Aucun commentaire:

Enregistrer un commentaire