Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use commands to deal with batch files in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use commands to deal with batch files in Linux? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Demand case 1

Put all 0_80_91.txt, 0_80_92.txt, 0_80_93.txt,. The file names of dozens of files, such as 0_81_91.txt, 0_81_92.txt, and 0_81_93.txt, have been modified. That is, change 80 in the file name to 81.

The implementation command is: ls * .txt | sed-nr's / (0_) (80) (.*) / mv\ 1\ 2\ 3\ 181\ 3Unigram gp' | sh

# 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.txtmv 0_80_92.txt 0_81_92.txtmv 0_80_93.txt 0_81_93.txt#ls * .txt | sed-nr's / (0 _) ) (80) (. *) / mv\ 1\ 2\ 3\ 181\ 3 GPP'| sh#ls * .txt0_81_91.txt 0_81_92.txt 0_81_93.txt

Demand case 2

Decompress and output all the files in the current directory to the specified file through the command cc_uncompress call. The call format is cc_uncompress-s 0_80_91.txt-d 1.txt. 1.txt can be any file name.

Implementation command 1 is: ls * .Z | sed-nr's / (. *) / cc_uncompress-s\ 1-d\ 1.txtUnigp'

# ls * .Z | sed-nr's / (. *) / cc_uncompress-s\ 1-d\ 1.txt/gp'cc_uncompress-s 0such 804th 91.Z-d 0_80_91.Z.txtcc_uncompress-s 088083.Z-d 0_80_93.Z.txt#ls * .Z | sed-nr's / (. *) / cc_uncompress -s\ 1-d\ 1.txtswap gp' | sh

Implementation command 2 is: find. -name "* .Z"-exec cc_uncompress-s {}-d {}. Bak\

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

After reading the above, have you mastered how to use commands to deal with batch files in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report