Text File – Get rid of Multiple NUL Characters

Background

Somehow I found myself with numerous NUL Characters in my text file; which coincidentally is a PowerShell Script (ps1) file.

 

Sample Contents

Here is what my file looks like:

NUL-Characters

 

 

Address

Notepad++

Let us address using Notepad++

Review whether special symbols are being shown

Use menu items – “View” \ “Show Symbol”

 

viewSpecialSymbols

Confirmed that we are not set to Show Special symbols; interpreted to mean this is the actual file contents.

 

Choose Search and Replace

  • Choose the menu items “Search” \ “Replace”
  • In the Replace Dialog do the following
    • In the “Find What” entry box, enter \x00
    • Make sure that the “Replace with” entry box is left empty
    • In the “Search Mode” group-box, select “Extended (\n, \r, , \x…)
    • Click on the “Replace All” button
  • Magically, all the  NUL-Character will be gone
  • Select the “Close” button to exit the “Replace” dialog

 

Replace-SearchMode-Extended

 

Listening

This problem really bugged me and had me thinking and listening to Monica:

Monica – Don’t take it personal(just one of them days)
https://www.youtube.com/watch?v=a9ZTiymoC5A

 

Hopefully next time this befalls me, I will remember I burnt a few hours on it and was all morose, but was able to find a solution (at the end).

Obviously, stealing lines from “The Best Exotic Marigold Hotel.

Quotes

The Best Exotic Marigold Hotel

“Everything will be alright in the end so if it is not alright it is not the end.”

“The only real failure is the failure to try, and the measure of success is how we cope with disappointment.”

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s