Home Dashboard Directory Help
Search

$ORS(output record separator) variable like awk's ORS for more flexible output by S.K. _


Status: 

Active


2
1
Sign in
to vote
Type: Suggestion
ID: 773209
Opened: 12/1/2012 8:35:20 PM
Access Restriction: Public
0
Workaround(s)
view

Description

Now powershell has $OFS(output field separator) but don't have "output record separator" like awk's ORS.
So when we don't want to start a new line with all lines, we have to use Write-Host -NoNewline.
Or, when we want to start a new line twice with a record, we have to add '`n' to all lines.

Eample

PowerShell > 1..5 # default record separator is '`n'
1
2
3
4
5

PowerShell > $ORS = '' # no separator for records
PowerShell > 1..5
12345

PowerShell > $ORS = ',' # record separator is ','
PowerShell > 1..5
1,2,3,4,5

PowerShell > $ORS = "`n`n" # record separator is '`n`n'
PowerShell > 1..5
1

2

3

4

5
Details
Sign in to post a comment.
Sign in to post a workaround.