Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

how to add Unix line breaks

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-12-2007   #1 (permalink)
Antti
Guest


 

how to add Unix line breaks

Hi.

So, is it possible to use set-content (or something) to add Unix line breaks
to a text file?

--
Antti



My System SpecsSystem Spec
Old 07-12-2007   #2 (permalink)
Bart
Guest


 

Re: how to add Unix line breaks

the Community extentions contain a cmd-let called "ConvertTo-UnixLineEnding"

you can find the extentions here..

http://www.codeplex.com/PowerShellCX


rgds,

Bart

"Antti" <ab@cd.ef> wrote in message
news:OAwIPDHxHHA.4604@TK2MSFTNGP03.phx.gbl...
> Hi.
>
> So, is it possible to use set-content (or something) to add Unix line
> breaks to a text file?
>
> --
> Antti
>



My System SpecsSystem Spec
Old 07-12-2007   #3 (permalink)
Keith Hill
Guest


 

Re: how to add Unix line breaks

"Bart" <notsovalid@oiuytr.com> wrote in message
news:e7xqvYHxHHA.4588@TK2MSFTNGP05.phx.gbl...
> the Community extentions contain a cmd-let called
> "ConvertTo-UnixLineEnding"
>
> you can find the extentions here..
>
> http://www.codeplex.com/PowerShellCX
>


You could just use `n as in:

"hi`nthere" | Set-Content -Encoding ascii foo.txt

The problem is that both Set-Content and Out-File append a Windows newline
sequence e.g.:

8> fhex foo.txt -Columns 16

Address: 0 1 2 3 4 5 6 7 8 9 A B C D E F ASCII
-------- ----------------------------------------------- ----------------
00000000 68 69 0A 74 68 65 72 65 0D 0A hi.there..

So processing the file to convert Windows newline sequences to \n (ie use
ConvertTo-UnixLineEnding) is probably the best way to go.

--
Keith

My System SpecsSystem Spec
Old 07-20-2007   #4 (permalink)
Antti
Guest


 

Re: how to add Unix line breaks

Ok. Thanks for your answers.

--
Antti


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get pid, equivalent to $$ in unix Frank PowerShell 1 07-27-2007 01:26 PM
Facts about Unix Mrs. Happy Vista General 25 07-13-2007 07:49 PM
RE: Line Count (UNIX wc) red_deer_hill PowerShell 0 01-26-2007 12:07 PM
RE: Line Count (UNIX wc) Sung M Kim PowerShell 0 01-24-2007 11:52 AM
Re: Line Count (UNIX wc) /\/\o\/\/ [MVP] PowerShell 0 01-24-2007 10:21 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51