Enhanced script learning to create dry and automation tools

Source: Internet
Author: User

On weekdays, many things can be completed using scripts. Learn the necessary scripts and write the scripts to replace the manual ones.
Our goals are dry and automation.
Required tools:
Shell
Perl
Linux tools: SED, replace, find, xargs, and so on.
For example, you can use the replace command to replace some content in the file:

# Replace audio image -- File

Or, process all the objects in the current directory as follows:

# Find.-Type F-exec replace audio image --{}';'

Use sed to write the replace script:

#! /Bin/shtmp_file = temp_temp.tmpif [! $ #-EQ 3] Then ECHO "Usage: replace. sh match pattern file "; exit; fised-e" s/$1/$2/g "$3> $ tmp_filemv $ tmp_file $3

Then the application is as follows:

# Replace. Sh audio image file1

Or

# Find.-Type F-exec./replace. Sh audio image {}';'

The so-called cutting power without mistake, take some time to learn these script languages and write scripts to replace manual operations, will greatly improve work efficiency. For more information about dry and automation, see pragmatic programmer and the productive programmer.

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.