Shell character (string) processing command

Source: Internet
Author: User

1.find find files that match your search criteria
Find Pathname-options [-print-exec-ok ...]
--options:
-perm: File lookup permission, plus number
-type: File type, plus f: File D: Directory L: Symbolic link file
-group: Find files belonging to group specified user groups

-exec: followed by command commands
command terminates with a semicolon ";" To be sure that there must be a '; ' in the back
{}, using {} to represent the file name, that is, the files that were filtered out in the previous process of find, are used for command commands, but may have different meanings for different systems using semicolons directly, using the "\ ' character of the transfer" to specify it before the semicolon.
-OK: followed by command commands, unlike-exec, each command requires the user to confirm whether or not to execute.
Example: (1). list files with root characters in the file name
Find/-type F-name "*root*"-exec ls-l {} \;

The 2.tr filter tr is used to convert characters from standard input.
TR [OPTION] ... SET1 [SET2]
1 ', converts all lowercase characters in passwd to lowercase characters
tr [A-z] [a-z] </etc/passwd
--options
-S: Removes all characters that are duplicated with SET1, leaving only the first one.
2 ', remove the duplicate E
Tr-s ' E ' <test4.txt
Tr-s ' e ' F ' <test4.txt convert E to F and remove the duplicate F
-D: Delete SET1-like characters
3 ', remove the ': ' in passwd
Tr-d ': '/etc/passwd
3.

Shell character (string) processing command

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.