Michael Lazin via plug on 10 Feb 2021 17:52:07 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Scripting question


Awesome, thanks!   I appreciate all of your help.  I have a rather unique problem that I actually have to use powershell for my project and I am making great progress by simply googling how to write the equivalent commands in powershell.  Today I learned that select-string -pattern can be followed by the exact same syntax as egrep and it's function is identical.  It is truly painful to be forced to use windows but I am adapting.  Believe it or not this helps me.

Thanks so much for your help. 



On Wed, Feb 10, 2021, 6:16 PM James Fiore <james.fiore@gmail.com> wrote:
In case you're interested for the future, the "-B n" option gives you n lines of context before the matched line and "-C n" gives you n lines both before and after the matched line.

Sent from my phone. Please excuse my brevity.

On Wed, Feb 10, 2021, 5:53 PM Michael Lazin via plug <plug@lists.phillylinux.org> wrote:
Thanks!   That makes sense.  I tested it out and it worked great.  

On Wed, Feb 10, 2021, 5:48 PM Carl Johnson <cjohnson19791979@gmail.com> wrote:
Add the "-An" argument. Where the "n" is the number of lines that you want to see after the match. 




On Wed, Feb 10, 2021, 5:45 PM Michael Lazin via plug <plug@lists.phillylinux.org> wrote:
I like to think I am good at bash scripting but I am a little bit stumped.  I am used to using commands like grep and egrep, but I want to match a pattern in text and then output not just the line that has the pattern but also a few subsequent lines.  Can someone please give me a suggestion?  Thanks again for your help 

Michael Lazin 
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug