-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeadpeople.ps1
More file actions
executable file
·57 lines (30 loc) · 1.96 KB
/
deadpeople.ps1
File metadata and controls
executable file
·57 lines (30 loc) · 1.96 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
cls
#23 types of information on each line
#RecordID, Lot Number, Cementery Name, SOrting letter, sorting number, site Code, Map Number, Burial Last Name, Furial First Name, Title, Year of Death, Month of Death, Day of Death, Material, type of marker, Notes, Record date, Path, SiteImage, cMOD, cDOD, cYOD, Date of Death
$db = "C:\test\cobdb-deadpeople.csv"
$BDFfile = "C:\test\cobdp2.bdf"
$lines = Get-Content $db
$prevPath = "temp"
foreach($line in $lines){
$pattern = "(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)"
$Outputstring = ""
if($line -match $pattern -AND $matches[18] -eq $prevPath){
$LevelTwo = $matches[8] + "|" + $matches[9] + "|" + $matches[10] + "|" + $matches[12] + "|" + $matches[13] + "|" + $matches[11] + "|"
# Add-Content -path $BDFfile -value $LevelTwo
[IO.File]::AppendAllText($BDFfile,$leveltwo,[System.Text.Encoding]::UTF8)
}elseif($line -match $pattern){
if(Test-Path $BDFfile){
echo("BDF Already Exists")
}
else
{
New-Item -ItemType file $BDFfile
}
$Outputstring = $matches[18] + "|L|6|~" + $matches[2] + "|" + $matches[3] + "|" + $matches[14] + "|" + $matches[15] + "|" + $matches[16] + "|" + $matches[17] + "|Survey Sheet~|" + $matches[8] + "|" + $matches[9] + "|" + $matches[10] + "|" + $matches[12] + "|" + $matches[13] + "|" + $matches[11] + "|"
# Add-Content $BDFfile $Outputstring
[IO.File]::AppendAllText($BDFfile, "`r`n",[System.Text.Encoding]::UTF8)
[IO.File]::AppendAllText($BDFfile, $Outputstring,[System.Text.Encoding]::UTF8)
$prevPath = $matches[18]
$prevPath
}
}