Find the answer to your Linux question:
Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By Roxoff
Hi everyone. I'm having trouble using these commands to their full extent. Here is my problem: I'm dumping a log to the terminal and only want a specific set of ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    3

    Using grep and sed


    Hi everyone. I'm having trouble using these commands to their full extent. Here is my problem:

    I'm dumping a log to the terminal and only want a specific set of lines that start with
    Code:
    V/ CONTENT ( [some number]):
    But I want these lines without that junk in front of it. To display only the parts I want, I'm doing the log command piped with grep and sed

    Code:
    ./adb logcat | grep CONTENT | sed -e 's/CONTENT ( [some number]):/ /g'
    This leaves me with V/(stuff I want). I'm just not sure how to sed the V/ part out of it because in the sed command '/' symbols are used to separate fields. Anybody have an idea?

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,878
    My knowledge of sed is shorter than it's name, so this is a bit of a guess... Have you tried escaping the '/' character in the string (ie put a '\' before the '/')?
    vjd5023 likes this.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Nov 2011
    Posts
    3
    Worked perfectly. Cheers to you my man (or woman).

  4. #4
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,878
    Quote Originally Posted by vjd5023 View Post
    Worked perfectly. Cheers to you my man (or woman).
    What a great guess! Glad it worked, and I'm very much a bloke. To prove it I'd graciously accept a beer.
    Linux user #126863 - see http://linuxcounter.net/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •