Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9104213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:48:48+00:00 2026-06-17T01:48:48+00:00

i need help. I need get a substring in the next line 11:46:24.851239 IP

  • 0

i need help.

I need get a substring in the next line

11:46:24.851239 IP (tos 0x0, ttl 128, id 11289, offset 0, flags [none], proto UDP (17), length 229)

the result must be: ttl 128

I hope you can help me!

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:48:49+00:00Added an answer on June 17, 2026 at 1:48 am

    Try doing this :

    echo '11:46:24.851239 IP (tos 0x0, ttl 128, id 11289, offset 0, flags [none], proto UDP (17), length 229)' |
    grep -oP "\bttl\s+\d+\b"
    ttl 128
    

    NOTE

    • \b is a word boundary
    • \s is a space
    • + mean at least one or more preceding character
    • -P switch is pcre advanced useful syntax for grep
    • -o switch mean to print only the matching part

    EDIT

    If you want to put this in a variable :

    var=$(
        echo '11:46:24.851239 IP (tos 0x0, ttl 128, id 11289, offset 0, flags [none], proto UDP (17), length 229)' |
            grep -oP "\bttl\s+\d+\b"
    )
    echo "$var"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help to get a substring from a file. I have two variable,
I need help to get a response when I click on an Item from
Need your help to get the max of CAP_PRICE based on certain criteria in
I need some help to get this right, please. I have created an iPad
I need help regarding JOIN tables to get category name & author name from
i got some problem and need help .. my plan : 1. get ip
I need a little help here: I get a file from an HTML upload
Hi I need a little help: How to get profile URL given an UID?
I need some help, and before we get going, I know it is probably
I would need little help here. I'm trying to get the git respository from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.