Created
September 4, 2024 18:35
-
-
Save dylanmartin/50a79d4ad44ac932a5958480d541e578 to your computer and use it in GitHub Desktop.
fix headers
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
# Get all .txt files in the current directory | |
Get-ChildItem -Filter *.txt | ForEach-Object { | |
# Read the file content | |
$filePath = $_.FullName | |
$content = Get-Content $filePath | |
# Split the first line by tabs and replace the first and second columns' headers | |
$header = $content[0] -split "`t" | |
$header[0] = "Measure:volume" | |
$header[1] = "subject_000" | |
# Join the modified header back with tabs | |
$content[0] = $header -join "`t" | |
# Write the updated content back to the file | |
$content | Set-Content $filePath | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment