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.
Another thought:
% { $i = 0 } { "$i||$_" ; $i++ }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With