I am a beginner in Powershell. I have some queries. I am using Import-Csv cmdlet for a tab delimited text file that is generated from an old software. Below is an equivalent version of the delimited file. From the text file I have to filter those entries which has the destination->observability§bin as 1.
Time [s] Offset_Angle destination->observability§bin
0.00E+00 -0.20402611670286 0.00000000000000E+00
4.32E+02 0.21319658757004 0.00000000000000E+00
8.64E+02 0.26803683992125 0.00000000000000E+00
1.30E+03 2.67379011780784 1.00000000000000E+00
1.73E+03 -2.89704767087971 1.00000000000000E+00
2.16E+03 -2.93302157473406 1.00000000000000E+00
The code snippet is as below
$ap = Import-Csv -Delimiter "`t" -Path E:\Myfiles\textfile.txt
$ap|where-Object {$_.destination->observability§bin -eq "1.00000000000000E+00”}
I got the first line working. When I execute the second line it throws me an error message.
At line:1 char:34
+ $ap|where-Object {$_.destination->observability§bin
+ ~
You must provide a value expression following the '-' operator.
At line:1 char:53
+ ... _.destination->observability§bin -eq '1.0000 ...
+ ~~~
Unexpected token '-eq' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
So i guess it takes the '-' sign in the input parameter as an operator(char 34). I also tried some escape characters like back tick(`) before the - sign. But didnt get anything. Please help me with this.
Thanks.