For shell, sed, grep, and regular expressions in LINUX, this set must be well learned.
Source: Internet
Author: User
For shell, sed, grep, and regular expressions in LINUX, you must learn about the common Linux technology-Linux programming and kernel information. For more information, see the following. For example, for a person working in LINUX, shell, sed, grep, python, and other things are hard to learn. In addition, they are regular expressions, not proficient, after learning a lot of basic usage, the work efficiency will multiply! ~
For example, in today's operation, for the classification feature item files generated under a folder, you only need to add the number of feature words in the class at the end of the first line by a space, all of them are 300 (the original program has not been written, and you can rewrite the C ++ Program). This means that the database of 50 million files on one side is re-trained, and the time is about 1 hour. it would be much easier to directly use sed! ~
Sed "1 s/$/300/" filename
This is the replacement at the end of the first line of a single file, that is, the method of appending 300. However, it is obviously silly to do it one by one, directly adding the shell programming method:
For I in./*; do sed "1 s/$/300/" $ I> $ I; done
Note: This is good, but for sed, it may be the cause of the buffer. You cannot directly write $ I back to $ I. Otherwise, the file is empty. everyone should be careful about this and easily destroy data.
Correct syntax:
For I in./*; do sed "1 s/$/300/" $ I> named I .txt; mv named I .txt $ I; done
In this way, I will post the examples I have encountered in my work in the future. As an experience record, I will often learn from them.
In addition, we found that the OPERA9 browser is very easy to use, User Personalization is good, and it occupies a relatively small amount of resources, and the speed of opening webpages is quite fast, I tested the usage of a handful of resources. Haha, now I want to test and compare my occupational diseases :)
We found that Internet Explorer accounts for 110 MB of memory and 90% of CPU usage in four (relatively large) windows, with over 40 MB of OPERA and 10% of CPU usage. the problem may not be fully explained, but it reflects the difference to some extent! ~ In the future, the browser sequence will be: OPERA9, FIREFOX, and IE. IE. You can sleep without writing SPACE!
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.