Adding serial numbers as first column to a CSV file

Viewed 726

I have a text file that has a date followed by temperature values. I am converting it to a .csv file with the help of following command:

Import-Csv D:\Arduino\sketch_lm35\11-04-17-LM35.txt -Delimiter "`t" |
    Export-Csv D:\Arduino\sketch_lm35\test.csv -NoTypeInformation

So the generated .csv file will have the date as the first column and temperature as the second column. Now I need to insert a serial number as the first column in the .csv file. How can it be done with PowerShell?

1 Answers
Related