0

Trying to generate a string based on the content of a file which contains multiple lines as follow:

"Name1""Path""Setting"

I need to figure out how to extract the content within the first " and second ", so the result should be Name1

Any help would be greatly appreciated.

mklement0
  • 312,089
  • 56
  • 508
  • 622
sirobione
  • 13
  • 2

1 Answers1

0

A -split operation is probably simplest:

('"Name1""Path""Setting"' -split '"')[1]

Regex-based alternative via the -replace operator:

'"Name1""Path""Setting"' -replace '^"(.*?)".*', '$1'

Both commands yield verbatim Name1.

mklement0
  • 312,089
  • 56
  • 508
  • 622