sapmple.txt as below
row1col1||col2||col2||col3
row2col1||col2||col2||col3
row3col1||col2||col2||col3
expected
0||row1col1||col2||col2||col3
1||row2col1||col2||col2||col3
2||row3col1||col2||col2||col3
I coded like
get-content "C:\sample.txt" | foreach { "[|][|]" + $_ } | foreach { Index + $_ } | set-content "C:\sample1.txt"
calling the pipe and then respective index, but not working.
Can you please help.