Common shell command combination in Linux

Source: Internet
Author: User

Change the contents of the file in each line in the 20140321_files.txt file to Action_begin,
Sed-i "s/action/action_begin/g" ' Cat 20140321_files.txt '


Replace the file contents tags in 20140321_files.txt with tags.php
Sed-i "s/tags/tags.php/g" ' ls 20140321_files.txt '


Traversal loops 20140321_files.txt each row of paths/root/20140321/tags.php copy the past
For F in ' Cat 20140321_files.txt ';d o cp/root/20140321/tags.php $F;d One


Find all tags.php in the home directory to update the user rights that the file belongs to by using the path
1 #!/bin/bash
2 for F in ' find/home-name ' tags.php ';
3 do
4 user= "' Echo $F | Awk-f '/' {print $} ';
5 chown $user: $user $F
6 Done


Find the contents of all tags.php files under/home/that contain Action_begin, and the file is located in the thinkphp directory
find/home/-name "tags.php" | Xargs grep "Action_begin" | grep "thinkphp"

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.