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 8242599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:13:27+00:00 2026-06-07T21:13:27+00:00

I know, don’t parse using curl, grep and sed. But I am looking for

  • 0

I know, don’t parse using curl, grep and sed. But I am looking for an easy approach, not a very safe one.

So I get an HTML file with curl, from which I need a value of a certain attribute from a tag. I use grep to get me the line where it says token. This only occurs once.
This gives me a whole div:

<div class="userlinks">
  <span class="arrow flleft profilesettings">settings</span>
  <form class="logoutform" method="post" action="/logout">
    <input class="logoutbtn arrow flright" type="submit" value="Log out">
    <input type="hidden" name="ltoken" value="a5fc8828a42277538f1352cf9ea27a71">
  </form>
</div>

How can I get just the value attribute (e.g. “a5fc8828a42277538f1352cf9ea27a71”)?

  • 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-07T21:13:29+00:00Added an answer on June 7, 2026 at 9:13 pm

    There’s no need to grep:

    sed -n '/token/s/.*name="ltoken"\s\+value="\([^"]\+\).*/\1/p' input_file
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the colorbox plugin for jQuery. I know I don't have to have
I don't know why, but this code worked for me a month ago... maybe
I don't know what I'm doing wrong but I've been trying to get this
I don't know whether all coffeescript compilers wrap their scripts in anonymous functions, but
I don't know if what I'm asking is even possible, but here's my situation.
I know constructors don't return anything but for instance if I call CMyClass *object
I know you don't like helping others in their homework but I have to
I'm still learning C#, and I know don't know about WinForms yet but I
I know that Silverlight has a port limitation when using nettcpbinding. What I don't
I don't know where I went wrong but I'm generally trying to write a

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.