forked from markgar/ConvertFrom-FixedWidth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runlocally.ps1
30 lines (21 loc) · 890 Bytes
/
runlocally.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Always load the latest version
Remove-Module -Name ConvertFrom-FixedWidth
Import-Module -Name './ConvertFrom-FixedWidth/ConvertFrom-FixedWidth.psd1' -Force
#############################
# EXAMPLE1
$fixedWidthText = Get-Content -Path ./sample1.txt
$columns = 10, 24
$objectTable = ConvertFrom-FixedWidth -FixedWidthTableText $fixedWidthText -ColumnIndexArray $columns
$objectTable | ConvertTo-Json
#############################
# EXAMPLE2
$fixedWidthText = Get-Content -Path ./sample2.txt
$columns = 20, 30
$objectTable = ConvertFrom-FixedWidth -FixedWidthTableText $fixedWidthText -ColumnIndexArray $columns
$objectTable | ConvertTo-Json
#############################
# EXAMPLE3
$fixedWidthText = Get-Content -Path ./sample3.txt
$columns = 20, 30
$objectTable = ConvertFrom-FixedWidth -FixedWidthTableText $fixedWidthText -ColumnIndexArray $columns
$objectTable | ConvertTo-Json