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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:18:38+00:00 2026-06-09T21:18:38+00:00

I have a page exported from a wiki and I would like to find

  • 0

I have a page exported from a wiki and I would like to find all the links on that page using bash. All the links on that page are in the form [wiki:<page_name>]. I have a script that does:

...
# First search for the links to the pages                                                                                                                                    
search=`grep '\[wiki:' pages/*`

# Check is our search turned up anything                                                                                                                                     
if [ -n "$search" ]; then
    # Now, we want to cut out the page name and find unique listings                                                                                                         
    uniquePages=`echo "$search" | cut -d'[' -f 2 | cut -d']' -f 1 | cut -d':' -f2 | cut -d' ' -f 1 | sort -u`
....

However, when presented with a grep result with multiple [wiki: text in it, it only pulls the last one and not any others. For example if $search is:

Before starting the configuration, all the required libraries must be installed to be detected by Cmake. If you have missed this step, see the [wiki:CT/Checklist/Libraries “Libr By pressing [t] you can switch to advanced mode screen with more details. The 5 pages are available [wiki:CT/Checklist/Cmake/advanced_mode here]. To obtain information about ea – ”’Installation of Cantera”’: If Cantera has not been correctly installed or if you do not have sourced the setup file ”’~/setup_cantera”’ you should receive the following message. Refer to the [wiki:CT/FormulationCantera “Cantera installation”] page to fix this problem. You can set the Cantera options to OFF if you plan to use built-in transport, thermodynamics and chemistry.

then it only returns CT/FormulationCantera and it doesn’t give me any of the other links. I know this is due to using cut so I need a replacement for the $uniquepages line.

Does anybody have any suggestions in bash? It can use sed or perl if needed, but I’m hoping for a one-liner to extract a list of page names if at all possible.

  • 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-09T21:18:40+00:00Added an answer on June 9, 2026 at 9:18 pm
    egrep -o '\[wiki:[^]]*]' pages/* | sed 's/\[wiki://;s/]//' | sort -u
    

    upd. to remove all after space without cut

    egrep -o '\[wiki:[^]]*]' pages/* | sed 's/\[wiki://;s/]//;s/ .*//' | sort -u
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SharePoint 2010 I have an enterprise wiki site, that I exported and imported from
I have page (Default1.aspx) in which I am redirecting to another page (Default2.aspx) using
I have page which is redirected from htaccess. now I can pass the German
I have a website that does not have page refreshes when the visitor navigates
Ok, I have page one(index), fully functional and working fine as is with all
I have a number of SSRS 2008 reports that need to be exported to
I have a ssrs report that when exported to word gives ~7 pages. When
I have a long-running asynchronous task that is kicked off from an ASP.NET MVC4
I have a report in SSRS 2005 that consists of three subreports, all four
I have a 2-page PDF that I want to overlay information on (think of

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.