Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

search string in file

$
0
0

Hello all,

All I'm trying to do is search a file for a string and print out that line.   That's it !   However, this seems hard to do it seems.  In linux, I use 'grep' which does exactly what i'm looking for.  But it seems like when i use get-content or select-string, it doesn't preserve the carriage return at the end and then select-string puts the name of the file and the number where it found it ahead of the whole line.  I think I read that when it finds a line it puts it in and array and treats the line as an object.  All I want to do is when I find a string in a line print the line and only that line - including the line return at the end. 

Thanks,

Chris


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>