In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the "Linux file search, modification and reading methods" related knowledge, in the actual case of the operation process, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
1. Find a file that contains keywords
Find the current directory. / and all files in the subdirectory that contain the "192" keyword
Find. / "*. *" | xargs grep-s "192"
two。 Modify system time
Set hardware time
Hwclock-set-date= "09:45 on 10-21-19"
Synchronization system time is hardware time hwclock-w
3. Batch modify files to change 9443 in all suffixes .conf files to 8080sed-I's Unix 9443Accord 8080Accord'* .conf
4. Use awk to count log time script example
Each line of the log 1.log is shaped like A&B&C&D&E&Time=256&F&G&H&K
We need to extract the information in the Time=256 column.
Cat 1.log | awk-F "&"'{print $6}'
The delimiter is & print out the sixth column
Further, the average value is calculated by statistical Time.
Cat 1.log | awk-F "&"'{print $6}'
| | awk-F'='{print $2}'| awk'{print a/NR} 1} END {print a/NR} "
5. Copy some lines of the file sed-n '5997p' 1.txt > > 2.txt
6. Read the contents of the file line by line filename is the file to be read scenario 1, #! / bin/bashcat filename | while read linedoecho $linedone
Option 2. For line in `cat filename`doecho $linedone
Option 3. #! / bin/bashwhile read linedoecho $linedone < filename
This is the end of the content of "methods for finding, modifying and reading Linux files". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.