Montag, 26. September 2016

Equivalent to grep being used in a pipe

Select-String (official documentation)

To search files recursively: Get-ChildItem -Path "path" | Select-String -Pattern "to look for" -CaseSensitive (official documentation of Get-ChildItem)

@ => Unrecognized token in source text.

Error

At P:\My Roaming Documents\west-3325\west_3325.ps1:12 char:48
+ $Result=sqlplus SDM_DATA/SDM_DATA_DEV@D52PMDWH @ west_3325.sql
+                                                ~
Unrecognized token in source text.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : UnrecognizedToken

Problem

@ is a special character in PowerShell:
 @(...)                 Force an expression to be evaluated as an array

Solution

Use a tic to escape it:
$Result=sqlplus SDM_DATA/SDM_DATA_DEV@D52PMDWH `@ west_3325.sql