Skip to content

Replacing Tabs and Newlines

Linux


# Replace '\n' with newlines and '\t' for tabs:
cat <filename> | sed 's/\\n/\n/g' | sed 's/\\t/\t/g' > <filename>

Windows


  • PowerShell

    # Replace '\n' with newlines and '\t' for tabs:
    (Get-Content -Raw -Path <filename>) -replace '\\n', "`n" -replace '\\t', "`t" | Set-Content -Path <filename>
    

  • CMD

    yikes