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

  • SEARCH
  • Home
  • 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 8015835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:22:09+00:00 2026-06-04T20:22:09+00:00

I having problems in extracting the word from a line. What i want is

  • 0

I having problems in extracting the word from a line. What i want is that it picks the first word before the symbol # but after the /. Which is the only delimiter that stand out.

A line looks like this:

,["https://picasaweb.google.com/111560558537332305125/Programming#5743548966953176786",1,["https://lh6.googleusercontent.com/-Is8rb8G1sb8/T7UvWtVOTtI/AAAAAAAAG68/Cht3FzfHXNc/s0-d/Geek.jpg",1920,1200]

I want the word Programming.

To get that line i am using this which narrows it down.

sed -n '/.*picasa.*.jpg/p' 5743548866439293105

So i want it to pretty much find # and then go backward until it hit the first /. Then print it out. In this case the word should be Programming but could be anything.

I want it to be as short as possible and have experimented with

sed -n '/.*picasa.*.jpg/p' 5743548866439293105 | awk '$0=$2' FS="/" RS="[$#]"
  • 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-04T20:22:12+00:00Added an answer on June 4, 2026 at 8:22 pm

    You can do that with sed (slightly shortened for formatting but works on your original string as well):

    pax> echo ',["https://p.g.com/111/Prog#574' | sed 's/^[^#]*\/\([^#]*\)#.*$/\1/'
    Prog
    pax> 
    

    Explaining in more detail:

        /---+------------------> greedy capture up to '/'.
       /    |
       |    | /------+---------> capture the stuff between '/' and '#'.
       |    |/       |
       |    ||       | /-+-----> everything from '#' to end of line.
       |    ||       |/  |
       |    ||       ||  |
    's/^[^#]*\/\([^#]*\)#.*$/\1/'
                          ||
                          \+---> replace with captured group.
    

    It basically searches for an entire line that has the pattern you want (first # following a /), whilst capturing (with the \( and \) brackets) just the stuff between / and #.

    The substitution then replaces the entire line with just that captured text you’re interested in (via \1).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some problems extracting the data I want from a SimpleXMLElement object.
Im having problems with classpaths. I have used them before with import but I'm
Having problems getting the different arrays content from geocoder results. item.formatted_address works but not
I am having problems extracting a list from a list. (defun delete (a l)
im having problems starting a codeigniter project, the problem is that when i do
I have started having problems with my VPS in the way that it would
Having problems with IE8... I have a button that onclick fires the showImageBrowser() function.
I seem to be having a problem with extracting data from a stringstream. The
I'm having difficulty extracting a single node value from a nodelist. My code takes
having problems with .prop(disabled, false) it's works fine in opera and firefox but IE

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.