Powershell unix equivilent of vi -b

Posted on 2011-09-10
Last Modified: 2012-05-12
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.
Question by:rwskas
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 13

Expert Comment

ID: 36517757

Expert Comment

ID: 36521980
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.
LVL 70

Accepted Solution

Qlemo earned 500 total points
ID: 36524549
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


Author Closing Comment

ID: 36525011
That worked, THanks

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question