<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.melissadata.com/index.php?action=history&amp;feed=atom&amp;title=Geo%2AData%3AFAQ</id>
	<title>Geo*Data:FAQ - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.melissadata.com/index.php?action=history&amp;feed=atom&amp;title=Geo%2AData%3AFAQ"/>
	<link rel="alternate" type="text/html" href="http://wiki.melissadata.com/index.php?title=Geo*Data:FAQ&amp;action=history"/>
	<updated>2026-05-01T16:52:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://wiki.melissadata.com/index.php?title=Geo*Data:FAQ&amp;diff=19963&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;&amp;larr; Geo*Data {{CustomTOC}} ==Instructions==  Here is an &#039;&#039;&#039;Unsupported&#039;&#039;&#039; and &#039;&#039;&#039;Untested script&#039;&#039;&#039; that can be used with &#039;&#039;&#039;Windows PowerShell&#039;&#039;&#039; to Split the new &lt;code&gt;US.txt&lt;/code&gt; file found in &#039;&#039;&#039;GeoDAT_202310&#039;&#039;&#039; into individual State Files.  This may be useful for GeoData users that still want previous legacy format with every file separated instead of the updated all-in-one state file (US.txt).  ===Download GeoData Update (GeoDAT_YYYYMM)=== Downloa...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.melissadata.com/index.php?title=Geo*Data:FAQ&amp;diff=19963&amp;oldid=prev"/>
		<updated>2023-11-17T01:28:14Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/index.php?title=Geo*Data&quot; title=&quot;Geo*Data&quot;&gt;← Geo*Data&lt;/a&gt; {{CustomTOC}} ==Instructions==  Here is an &amp;#039;&amp;#039;&amp;#039;Unsupported&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Untested script&amp;#039;&amp;#039;&amp;#039; that can be used with &amp;#039;&amp;#039;&amp;#039;Windows PowerShell&amp;#039;&amp;#039;&amp;#039; to Split the new &amp;lt;code&amp;gt;US.txt&amp;lt;/code&amp;gt; file found in &amp;#039;&amp;#039;&amp;#039;GeoDAT_202310&amp;#039;&amp;#039;&amp;#039; into individual State Files.  This may be useful for GeoData users that still want previous legacy format with every file separated instead of the updated all-in-one state file (US.txt).  ===Download GeoData Update (GeoDAT_YYYYMM)=== Downloa...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Geo*Data|&amp;amp;larr; Geo*Data]]&lt;br /&gt;
{{CustomTOC}}&lt;br /&gt;
==Instructions==&lt;br /&gt;
&lt;br /&gt;
Here is an &amp;#039;&amp;#039;&amp;#039;Unsupported&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Untested script&amp;#039;&amp;#039;&amp;#039; that can be used with &amp;#039;&amp;#039;&amp;#039;Windows PowerShell&amp;#039;&amp;#039;&amp;#039; to Split the new &amp;lt;code&amp;gt;US.txt&amp;lt;/code&amp;gt; file found in &amp;#039;&amp;#039;&amp;#039;GeoDAT_202310&amp;#039;&amp;#039;&amp;#039; into individual State Files.&lt;br /&gt;
&lt;br /&gt;
This may be useful for GeoData users that still want previous legacy format with every file separated instead of the updated all-in-one state file (US.txt).&lt;br /&gt;
&lt;br /&gt;
===Download GeoData Update (GeoDAT_YYYYMM)===&lt;br /&gt;
Download and Extract &amp;#039;&amp;#039;&amp;#039;GeoDAT_202310&amp;#039;&amp;#039;&amp;#039; folder onto your local desktop.&lt;br /&gt;
&lt;br /&gt;
===Download and Extract GeoData_SplitState_Test.zip===&lt;br /&gt;
Download and Extract the &amp;lt;code&amp;gt;GeoData_SplitState_Test.zip&amp;lt;/code&amp;gt; below and save the &amp;lt;code&amp;gt;Split_All_States_20231114.ps1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Split_By_State_Test.ps1&amp;lt;/code&amp;gt; to the &amp;#039;&amp;#039;&amp;#039;GeoDAT_202310&amp;#039;&amp;#039;&amp;#039; folder.&lt;br /&gt;
&lt;br /&gt;
For example: &amp;lt;code&amp;gt;C:\Users\Roxanne\Desktop\GeoDAT_202310\&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:GeoData FAQ SplitFile.png|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Open Windows PowerShell as Administrator===&lt;br /&gt;
Open &amp;quot;&amp;#039;&amp;#039;&amp;#039;Windows PowerShell&amp;#039;&amp;#039;&amp;#039;&amp;quot; as &amp;#039;&amp;#039;&amp;#039;Administrator&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
===Change Drive to GeoDAT_YYYYMM file path===&lt;br /&gt;
Change drive to the File path of &amp;#039;&amp;#039;&amp;#039;GeoDAT_202310&amp;#039;&amp;#039;&amp;#039; on your desktop and press &amp;#039;&amp;#039;&amp;#039;Enter&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
PS C:\WINDOWS\system32&amp;gt; cd &amp;quot;C:\Users\Roxanne\Desktop\GeoDAT_202310\&amp;quot;&lt;br /&gt;
&lt;br /&gt;
PS C:\Users\Roxanne\Desktop\GeoDAT_202310&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Determine if you want to Split the US.txt file==&lt;br /&gt;
Determine if you want to Split the US.txt file by &amp;#039;&amp;#039;&amp;#039;all States at one time&amp;#039;&amp;#039;&amp;#039; OR &amp;#039;&amp;#039;&amp;#039;one desired state file&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
===All States at One Time===&lt;br /&gt;
To Split the entire &amp;lt;code&amp;gt;US.txt&amp;lt;/code&amp;gt; file into individual state files at one time, please perform the following steps:&lt;br /&gt;
&lt;br /&gt;
Open  the &amp;lt;code&amp;gt;Split_All_States_Test.ps1&amp;lt;/code&amp;gt; in notepad to update the the following file paths before running the script in PowerShell:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# $txtFilePath&lt;br /&gt;
&lt;br /&gt;
# $idxFilePath&lt;br /&gt;
&lt;br /&gt;
# $outputFolderPath&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the file paths are updated, Save and close the the file.&lt;br /&gt;
&lt;br /&gt;
Type &amp;lt;code&amp;gt;.\Split_All_States_Test.ps1&amp;lt;/code&amp;gt; in Windows PowerShell and hit enter to split all states at once.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; This will parse out the state files into individual state files as done previously and may take awhile, Press CTRL+C to Stop the script. &lt;br /&gt;
&lt;br /&gt;
====File Contents: Split_All_States_Test.ps1====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Split GeoData - &amp;quot;US.txt&amp;quot; file by All States at once using the &amp;quot;US.idx&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
# PLEASE NOTE:&lt;br /&gt;
# This script has NOT been tested and is NOT supported.&lt;br /&gt;
# This script may take some time. If using Windows Powershell, type &amp;quot;CTRL + C&amp;quot; to Stop script from running.&lt;br /&gt;
&lt;br /&gt;
# The following paths must be updated before running:&lt;br /&gt;
	# $txtFilePath&lt;br /&gt;
	# $idxFilePath&lt;br /&gt;
	# $outputFolderPath &lt;br /&gt;
&lt;br /&gt;
# Last Updated: 2023-11-14 &lt;br /&gt;
&lt;br /&gt;
# Define the paths to the US.txt file and the US.idx file&lt;br /&gt;
$txtFilePath = &amp;quot;C:\Users\Roxanne\Desktop\GeoDAT_202310\TXT\US.txt&amp;quot;&lt;br /&gt;
$idxFilePath = &amp;quot;C:\Users\Roxanne\Desktop\GeoDAT_202310\TXT\US.idx&amp;quot;&lt;br /&gt;
$outputFolderPath = &amp;quot;C:\Users\Roxanne\Desktop\GeoDAT_202310\TXT&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
# Read the index file&lt;br /&gt;
$indexLines = Get-Content $idxFilePath&lt;br /&gt;
 &lt;br /&gt;
# Create the output folder if it doesn&amp;#039;t exist&lt;br /&gt;
if (!(Test-Path -Path $outputFolderPath -PathType Container)) {&lt;br /&gt;
    New-Item -Path $outputFolderPath -ItemType Directory&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
# Initialize variable to keep track of the cumulative record count&lt;br /&gt;
$recordOffset = 0&lt;br /&gt;
 &lt;br /&gt;
foreach ($indexLine in $indexLines) {&lt;br /&gt;
    # Parse the index line to get the state abbreviation and count&lt;br /&gt;
    $stateAbbreviation, $stateFIPS, $count = $indexLine -split &amp;#039;,&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
    # Convert the count to an integer&lt;br /&gt;
    $count = [int]$count&lt;br /&gt;
 &lt;br /&gt;
    if ($stateAbbreviation -and $count -gt 0) {&lt;br /&gt;
        # Create a new output file with the state abbreviation&lt;br /&gt;
        $outputFileName = &amp;quot;${stateAbbreviation}.txt&amp;quot;&lt;br /&gt;
        $outputFilePath = Join-Path -Path $outputFolderPath -ChildPath $outputFileName&lt;br /&gt;
 &lt;br /&gt;
        # Read and append lines from the US.txt file to the current output file&lt;br /&gt;
        Get-Content $txtFilePath | Select-Object -Skip $recordOffset -First $count | Add-Content -Path $outputFilePath&lt;br /&gt;
 &lt;br /&gt;
        # Update the cumulative record count for the next state&lt;br /&gt;
        $recordOffset += $count&lt;br /&gt;
 &lt;br /&gt;
        Write-Host &amp;quot;Splitting complete for $stateAbbreviation.&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
Write-Host &amp;quot;Splitting complete for all states.&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===One Desired State File===&lt;br /&gt;
To Split an individual state file out of the &amp;lt;code&amp;gt;US.txt&amp;lt;/code&amp;gt; one at a time, please perform the following steps:&lt;br /&gt;
&lt;br /&gt;
Open  the &amp;lt;code&amp;gt;Split_By_State_Test.ps1&amp;lt;/code&amp;gt; in notepad to update the the following file paths before running the script in PowerShell:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$txtFilePath&lt;br /&gt;
&lt;br /&gt;
$idxFilePath&lt;br /&gt;
&lt;br /&gt;
$outputFolderPath&lt;br /&gt;
&lt;br /&gt;
$desiredState&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the file paths are updated, Save and close the the file.&lt;br /&gt;
&lt;br /&gt;
Type &amp;lt;code&amp;gt;.\Split_By_State_Test.ps1&amp;lt;/code&amp;gt; in Windows PowerShell and hit &amp;#039;&amp;#039;&amp;#039;enter&amp;#039;&amp;#039;&amp;#039; to split an individual desired state.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:&amp;#039;&amp;#039;&amp;#039; Please note the new State file may take a moment to display in the TXT folder depending on the size.&lt;br /&gt;
&lt;br /&gt;
====File Contents: Split_By_State_Test.ps1 ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Split GeoData - &amp;quot;US.txt&amp;quot; file by Individual State using the &amp;quot;US.idx&amp;quot; file.&lt;br /&gt;
&lt;br /&gt;
# PLEASE NOTE:&lt;br /&gt;
# This script has NOT been tested and is NOT supported.&lt;br /&gt;
&lt;br /&gt;
# The following paths must be updated before running:&lt;br /&gt;
	# $txtFilePath&lt;br /&gt;
	# $idxFilePath&lt;br /&gt;
	# $outputFolderPath &lt;br /&gt;
	# $desiredState &lt;br /&gt;
&lt;br /&gt;
# Last Updated: 2023-11-14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Define the paths to the US.txt file and the US.idx file&lt;br /&gt;
$txtFilePath = &amp;quot;C:\Users\Roxanne\Desktop\GeoDAT_202310\TXT\US.txt&amp;quot;&lt;br /&gt;
$idxFilePath = &amp;quot;C:\Users\Roxanne\Desktop\GeoDAT_202310\TXT\US.idx&amp;quot;&lt;br /&gt;
$outputFolderPath = &amp;quot;C:\Users\Roxanne\Desktop\GeoDAT_202310\TXT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Read the index file&lt;br /&gt;
$indexLines = Get-Content $idxFilePath&lt;br /&gt;
&lt;br /&gt;
# Create the output folder if it doesn&amp;#039;t exist&lt;br /&gt;
if (!(Test-Path -Path $outputFolderPath -PathType Container)) {&lt;br /&gt;
    New-Item -Path $outputFolderPath -ItemType Directory&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Initialize variables to keep track of line counts&lt;br /&gt;
$currentState = $null&lt;br /&gt;
$recordOffset = 0&lt;br /&gt;
&lt;br /&gt;
# Define the state you want to parse (e.g., &amp;quot;AL&amp;quot; for Alabama)&lt;br /&gt;
$desiredState = &amp;quot;AL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Loop through the index lines&lt;br /&gt;
foreach ($indexLine in $indexLines) {&lt;br /&gt;
    # Parse the index line to get the state abbreviation and count&lt;br /&gt;
    $stateAbbreviation, $stateFIPS, $count = $indexLine -split &amp;#039;,&amp;#039;&lt;br /&gt;
&lt;br /&gt;
    # Convert the count to an integer&lt;br /&gt;
    $count = [int]$count&lt;br /&gt;
&lt;br /&gt;
    # Check if the current state matches the desired state&lt;br /&gt;
    if ($stateAbbreviation -eq $desiredState -and $count -gt 0) {&lt;br /&gt;
        # Create a new output file with the state abbreviation&lt;br /&gt;
        $outputFileName = &amp;quot;${stateAbbreviation}.txt&amp;quot;&lt;br /&gt;
        $outputFilePath = Join-Path -Path $outputFolderPath -ChildPath $outputFileName&lt;br /&gt;
&lt;br /&gt;
        # Read and write lines from the US.txt file to the current output file&lt;br /&gt;
        Get-Content $txtFilePath | Select-Object -Skip $recordOffset -First $count | Set-Content -Path $outputFilePath&lt;br /&gt;
&lt;br /&gt;
        Write-Host &amp;quot;Splitting complete for $stateAbbreviation.&amp;quot;&lt;br /&gt;
        break  # Exit the loop after processing the desired state&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    # Update the record offset for the next state&lt;br /&gt;
    $recordOffset += $count&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Write-Host &amp;quot;Splitting complete for $desiredState.&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[Category:Geo*Data]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>