Linux Shell Line Flow programming practice

Source: Internet
Author: User

Many of the commands in Linux are very handy to use, especially when you're doing batch processing. (Saying that the program is not complicated, Windows has not engaged in a good shell?)

Here are some common applications of shell operations, the use and interpretation of specific commands are not listed, there are many good tutorials on the web.

Batch Rename

If there are several. wma files under the current directory, I want to convert them to. mp3 Files in bulk

Example: 001.wma-001.mp3

Solution:

Awk

?

1 ls * | awk -F ‘.‘ ‘{print "mv "$0" "$1".mp3"}‘| bash

Perl

Notation 1

?

1 ls * | perl -e ‘while(<>){chomp;$old=$_;s/wma/mp3/;print "mv $old $_\n"}‘| bash

Notation 2

?

1 ls * | perl -e ‘while(<>){chomp;$old=$_;s/mp3/wma/;rename $old, $_;}‘

Not to be continued ...

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.