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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:56:23+00:00 2026-06-11T14:56:23+00:00

I would like to take some stuff from file A and reformat it to

  • 0

I would like to take some stuff from file A and reformat it to stick into file B using regular expressions. I am kind of new to vim so this may be a dumb question but I could not find the solution to this anywhere. I guess I am searching for the wrong phrases. Anyway, here are the details of what I want to do. I have a static html page that I would like to have an RSS feed for. Luckily, this page is mostly links to various news items, so creating the RSS will be pretty easy.

I have the regular expression ready:

:%s/^<a href="\(.\{-}\)".title="\(.\{-}\)">\(.\{-}\)<\/a>/<title>\3<\/title>\r<link>\1<\/link>\r<description>\2<\/description> 

My problem is I do not want to make the changes in the html file that I am searching. I want the changes to occur in another file, new or existing. How do I make this happen? Or is this method completely off.

Oh and by the way, this expression takes something like this in the html file:

<a href="http://linktosomesite.com" title="Description of link">Title of Link</a>

and turns it into this in the xml file:

<title>Title of Link</title>
<link>http://linktosomesite.com</link>
<description>Description of link</description>

Bonus: It would be really nice if I can place this within another file, say starting at line 5.

PS: I know this is a vim and regex question but posting it in html and rss because I noticed people have static html to rss questions there.

  • 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-11T14:56:24+00:00Added an answer on June 11, 2026 at 2:56 pm

    It sounds like you want to write a transform. There are many transform tools. You certainly could do it with sed & awk for example. But I think the easiest way would be xslt. (you could use xsltproc or saxon…)

    Here’s an example template:

    <xsl:template match="a">
        <title><xsl:value-of select="text()"/></title>
        <link><xsl:value-of select="@href"/></link>
        <description><xsl:value-of select="@title"/></description>
    </xsl:template>
    

    It finds each a element, and outputs the results, with the text() node and attributes filled in.

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

Sidebar

Related Questions

I would like to take the memory generated from my struct and push it
i would like to take a live video feed from a video camera or
Originally I would like to transfer some content (div class=StaffBlock) which is loaded from
I would like to take the Roman Numeral value stored in the object and
I would like to take a string representation of a set and parse it.
I would like to take a field and replace all characters that are not
I would like to take a specific part of the last line of a
I would like to take the words of a sentence, if that word has
What I would like to take ownership of a hid device that may already
I'm working in python 2.6 and I would like to take gpmetisfile.txt.part.4 and return

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.