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
  • 382,024
  • 64
  • 607
  • 775
sirobione
  • 7
  • 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
  • 382,024
  • 64
  • 607
  • 775