Vim adds new content to the beginning and end of each line

Source: Internet
Author: User
Tags unsupported

Requirements:

Find a batch of HTML files from the current directory and use an HTML file to express their addresses with hyperlink so that other pages can be accessed through this page in the browser.

1. Find.-INAME "* Valid *. *"> valid.txt

Then the file name exists in the following format:

/ValidityState-002.html
/ValidityState-customError-expected.txt
/ValidityState-customError.html
/ValidityState-patternMismatch-expected.txt
/ValidityState-patternMismatch-unsupported-expected.txt
/ValidityState-patternMismatch-unsupported.html
/ValidityState-patternMismatch.html
/ValidityState-rangeOverflow-expected.txt
/ValidityState-rangeOverflow.html

...

2. The Form I want is:

<A href =/ValidityState-002.html>./ValidityState-002.html </a>

...

Solution:

A. Cat valid | while read line; do echo "$ line> $ line"> vv.html; done

B. VI vv.html

At this point the file content such as "href =./ValidityState-002.html>./ValidityState-002.html", to add the <A> label at the beginning and end of each line, fortunately there is a VI command

C. Add the "<a href =" Vim command: % S/^/<a href = "to each line.

D. Add the "</a>" Vim command at the end of each line: % S/$/<\/A>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.