Perl command-line common methods

Source: Internet
Author: User

A. Original text replacement


Perl-p-i.bak-e "s/source string/target string/g" < file name >


The original text is backed up as a. bak suffix file



B. Regular packet Extraction


echo "Tom and dic" | Perl-n-E ' @w =/(Tom). * (DIC)/; print "$w [0] & $w [1]" '


Print "Tom & DiC"



Note:-p Prints the string to output that satisfies the regular

-N does not print the string to the output, only the statements such as program print

This article is from the "New Youth" blog, please be sure to keep this source http://luckybins.blog.51cto.com/786164/1587990

Perl command-line common methods

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.