Last active
November 14, 2017 09:25
-
-
Save gitfvb/3be2c26756c3a1a3609a96291dd9c77b to your computer and use it in GitHub Desktop.
powershell csv gists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Import-CSV SomeFile.csv | Select *,LINENUMBER | ForEach-Object -Begin { $Line = 1 } { | |
| $_.LineNumber = $Line++ | |
| $_ | |
| } | Export-CSV SomeFile.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # for column "FI_NR", | |
| Import-CSV test.csv -Delimiter ";" | Select *,INCREMENTAL_SUM | ForEach-Object -Begin { $Increment = 0 } { | |
| $Increment += $_.FI_NR | |
| $_.INCREMENTAL_SUM = $Increment | |
| $_ | |
| } | Export-CSV SomeFile.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # file will be sorted for column username | |
| Import-Csv C:\fso\testusers.csv.old | sort username -Descending | Export-Csv -Path c:\fso\testusers.csv -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment