Solved

Powershell unix equivilent of vi -b

Posted on 2011-09-10
4
1,020 Views
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.
0
Comment
Question by:rwskas
4 Comments
 
LVL 13

Expert Comment

by:khairil
ID: 36517757
0
 
LVL 4

Expert Comment

by:krf1963
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.
0
 
LVL 68

Accepted Solution

by:
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

0
 
LVL 6

Author Closing Comment

by:rwskas
ID: 36525011
That worked, THanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now