Select-String not finding all values
hi,
i trying finding strings in file.
i using cmd:
get-content $pathcompletmanufacturiers | select-string "^$manufretenu\s*$" -quiet
all below values in file:
aladdin knowledge systems ltd.--> found
apn, llc--> found
fabasoft r&d gmbh--> found
winzip computing lp--> found
offshore - it--> found
notepad++ team--> generating error not regular expression
winklevoss technologies, llc (wintech) --> not found
visicom media inc. (powered panda security) --> not found
so appearing function may not finding values + or )(.
how may bypass problem?
thanks,
françois
try regexsafe function.
for example:
$a = get-content .\file1.txt $manufretenu = 'notepad++ team' $a | select-string (regexsafe $manufretenu) $manufretenu = 'winklevoss technologies, llc (wintech)' $a | select-string (regexsafe $manufretenu) $manufretenu = 'visicom media inc. (powered panda security)' $a | select-string (regexsafe $manufretenu)
it escapes regex metacharacters in select string
sam boutros, senior consultant, software logic, kop, pa http://superwidgets.wordpress.com (please take moment vote helpful and/or mark answer, applicable) _________________________________________________________________________________ powershell: learn before it's emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
Windows Server > Windows PowerShell
Comments
Post a Comment