Search

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

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)
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 (expand)
How often does this happen?
Always Happens
Have you seen this problem before in this product?
No, this is new to the most recent version
Reproduction Steps
 
Expected Results
 
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.