ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Topics
    2. Tags
    3. grep
    Log in to post
    • All categories
    • DustinB3403D

      Solved If I wanted to grep through a file or multiple at once....

      IT Discussion
      • grep unix docx2txt regex • • DustinB3403
      19
      0
      Votes
      19
      Posts
      1.4k
      Views

      M

      @DustinB3403 : Team effort! 🙂

    • 1

      Solved Searching for text in file

      IT Discussion
      • linux grep bash • • 1337
      7
      0
      Votes
      7
      Posts
      844
      Views

      dafyreD

      @Obsolesce said in Searching for text in file:

      @dafyre said in Searching for text in file:

      @Pete-S said in Searching for text in file:

      If you have a text file that looks like this:

      start_folder='/folder1/abc.txt' iterations='123' passphrase='xyz' last_command='invoke' return_value='0'

      How can you pick out just xyz when looking for "passphrase"?

      I know grep will get me the line but what should I use if I want just a part of the line?
      Can it be done in one command or do I have to pipe several together?

      If you the text has a character that would be a good delimiter, you can pipe grep to cut... ie:

      cat myfile.txt|grep "iterations"|cut -d '=' -f 2 Output: '123'

      the -f # is which column you want.

      There may be other ways to do it, but that's the first way I can think of.

      You can specify a file with grep, no need to pipe in from cat.

      This is true! I always seem to get it backwards when I do that, so i just cat $thefile | grep | blah ... Cuts down on frustration, ha ha.

    • 1

      Search text file for pattern

      IT Discussion
      • grep • • 1337
      17
      0
      Votes
      17
      Posts
      1.3k
      Views

      M

      I should have noted that grep likely wouldn't like complicated RE patterns. Sed, however, supports the full gamut and is installed by default on pretty much every linux variant; not sure if pcregrep is.

      It seems everyone likes the link I posted for the RE builder so I'll paste two others that I use:
      https://regex101.com/
      http://leaverou.github.io/regexplained/

      Cheers!

    • JaredBuschJ

      Need grep results sent to email

      IT Discussion
      • grep asterisk logging users • • JaredBusch
      10
      1
      Votes
      10
      Posts
      2.3k
      Views

      scottalanmillerS

      Ah ha, okay. Yeah, just copy/paste into crontab, should be all set.

      You'll want to run manually first and see if the emails come through. I tested on a FreePBX system and it went straight through to my Office 365 no problem.

      If you are on FreePBX, you will need mailx installed. All dependencies are met by a default install. It's a tiny binary package.

      yum -y install mailx

      That is what provides the mail command.

    • scottalanmillerS

      Using GREP to Find an IP Address

      IT Discussion
      • bash regular expression regex shell unix linux grep • • scottalanmiller
      1
      3
      Votes
      1
      Posts
      1.5k
      Views

      No one has replied

    • 1 / 1