Linux wildcard, wildcard

Source: Internet
Author: User

Linux wildcard, wildcard



Linux wildcard % c is different from * c

%. C is the GUNmake syntax layer, indicating all files ending with ". c"
*. C is the syntax layer of linux shell, such as rm-f *. o.
The meaning is basically the same, that is, GUNmake and shell.

Wildcards are not allowed in the linux Command mv.

It cannot be implemented through scripts.

Simply relying on the music video command, you need to implement it manually.

Compile the script rename as follows:

#----------------------------------------------
#! /Bin/sh

Ls-l $1 | grep ^ [^ d] | awk '{print $9}' | while read line; do
Do = 'echo $ line | grep $2'

If [! "$ Do" = ""]; then
Newname = 'echo $ line | sed's/'$ 2'/' $ 3'/G''
Echo "rename $ line to $ newname ..."
Mv $1/$ line $1/$ newname
Fi
Done
#------------------------------------------------
Save the above as a rename file,
Then run
Chmod + x rename
Enable rename to run

Then run rename in the following format:
Assume that rename is in the current path
$./Rename [fullpathtofiles]. JPG. jpg
[Fullpathtofiles] is the full file path.

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.