Thanks in advance.
PS > gc testing.txt
foo
#bar
123
PS >
# Something like this for v1:
PS > gc testing.txt| `
>> %{if($_ -match "^#"){"starts with #"}else{"doesn't start with #"}}
>>
doesn't start with #
starts with #
doesn't start with #
# Now for v2 CTP/CTP2:
PS > gc testing.txt|select-string -notmatch "^#"
foo
123
PS >
-NotMatch does add annoying blank lines to the output...
Marco
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
PS > gc testing.txt|`
>>%{if($_.startswith("#")){"starts with #"}else{"doesn't start with #"}}
>>
Of course there are even more possibilities...
(Get-Content testing.txt) -notmatch '^#'
Simple and fast!
--
http://www.jansveld.net/powershell
Yup, you're right on that one...
Marco
In the interests of throwing a spanner into the works, and also because I'm
a believer in the virtues of readable code (which generally means avoiding
regular expressions)....
Get-Content C:\Somefile.txt | Where {-not ($_.StartsWith('#'))}
--
Jon