Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1118
  • Last Modified:

Powershell unix equivilent of vi -b

Does anyone know the Powershell equivilent to the unix command 'vi -b'? I would like to be able read the line end characters of a file.
1 Solution
If you use the command:

get-content -encoding byte c:\file.txt

Powershell returns an array of bytes which is the content of the file. You can then examine the whole file a byte at a time.
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
To display e.g. ^M^J at the end of Windows text file lines, you can use:
(get-content c:\file.txt -Delimiter "§").Replace([string][char]13, "^M"+[char]13).Replace([string][char]10, '^J'+[char]10)

Open in new window

rwskasAuthor Commented:
That worked, THanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Building an Effective Phishing Protection Program

Join Director of Product Management Todd OBoyle on April 26th as he covers the key elements of a phishing protection program. Whether you’re an old hat at phishing education or considering starting a program -- we'll discuss critical components that should be in any program.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now