Preface The best method may not be the one you can think of the fastest. Scripts for temporary use at work do not need to be robust, and the faster they are written, the better. Here is a technique for using the sed command to construct commands to process batch files for reference. Demand Case 1 Copy all 0_80_91.txt, 0_80_92.txt, 0_80_93.txt, etc. in the current directory. . . The file names of dozens of files were changed to 0_81_91.txt, 0_81_92.txt, 0_81_93.txt, etc. That is, change 80 in the file name to 81. The implementation command is: #ls *.txt 0_80_91.txt 0_80_92.txt 0_80_93.txt #ls *.txt |sed -nr 's/(0_)(80)(.*)/mv \1\2\3 \181\3/gp' mv 0_80_91.txt 0_81_91.txt mv 0_80_92.txt 0_81_92.txt mv 0_80_93.txt 0_81_93.txt #ls *.txt |sed -nr 's/(0_)(80)(.*)/mv \1\2\3 \181\3/gp' | sh #ls *.txt 0_81_91.txt 0_81_92.txt 0_81_93.txt Demand Case 2 Decompress all 0_80_91.Z, 0_80_92.Z, and 0_80_93.Z files in the current directory using the cc_uncompress command and output them to the specified file. The calling format is cc_uncompress -s 0_80_91.txt -d 1.txt. 1.txt can be any file name. The implementation command 1 is: #ls *.Z | sed -nr 's/(.*)/cc_uncompress -s \1 -d \1.txt/gp' cc_uncompress -s 0_80_91.Z -d 0_80_91.Z.txt cc_uncompress -s 0_80_92.Z -d 0_80_92.Z.txt cc_uncompress -s 0_80_93.Z -d 0_80_93.Z.txt #ls *.Z | sed -nr 's/(.*)/cc_uncompress -s \1 -d \1.txt/gp' | sh The implementation of command 2 is: The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Ubuntu16.04 installation mysql5.7.22 graphic tutorial
>>: MySQL 5.6.23 Installation and Configuration Environment Variables Tutorial
Today we are going to make origami airplanes (the...
1. Effect display An astronaut watch face written...
Many people say that IE6 does not support PNG tra...
Docker queries or obtains images in a private reg...
Initialize Data DROP TABLE IF EXISTS `test_01`; C...
123WORDPRESS.COM provides you with the FileZilla ...
Scenario simulation: Some domestic companies need...
The differences among execute, executeUpdate, and...
Nginx's configuration syntax is flexible and ...
Element UI implements multiple tables scrolling a...
Table of contents Preface sql_mode explained The ...
question: Recently, garbled data appeared when de...
For more exciting content, please visit https://g...
Version 1.4.2 Official Documentation dockerhub st...
The front-end and back-end projects are separated...