Android Driver Development Sixth chapter notes

Source: Internet
Author: User

This chapter mainly explains the number of statistical words.

Count the number of a string in a file, in fact, it can be seen in a piece of sand to find stone, someone saw a stone, in the above do Mark grep, and then remember how many marks; when someone saw a stone, they dug it (TR) and finally counted how many stones they dug. Jump over It (awk) and count how many times you jump.

Cat file

Hafsdha

Hahafsdfsdhaha

haha

If I wanted to match the string ' haha '

-O option for 1.grep

The first time is to use the-C option, but the-C can only count a row, if there is more than one row of matching strings, then-C can do nothing.

This is the right one.

[Email protected] test]# grep-o ' haha ' file | Wc-l

3

[[email protected] test]# awk-v rs= ' haha ' END {print--nr} ' file

-V to set the value of a variable, RS is the record delimiter, the default is a new line (\ n), that is, awk reads the data in one line, but now RS is ' haha ', press ' haha ' after reading the data, NR is the number of read records, N records are separated by n-1 separators, So it's Nr.

Strictly speaking, TR cannot match a string, only to match a single character. This matches the number of ' H ' in this file.

[Email protected] test]# tr-cd ' h ' <file | Wc-c

8

[[email protected] test]# grep-o ' h ' file | Wc-l

8

-D can delete a character, and if only-D outputs the string after the deletion of a particular character, but-C can be reversed, which is the display of the deleted character. Then use the Wc-c to count the number of characters.

To write a Linux driver: 1. Build the Linu x drive skeleton (load and unload Linu x drive). 2.: Register and unregister the device files. 3. Specify driver-related information. 4. Specify the callback function. 5. Write the business logic. 6. Write the makefile file. 7. Compile the Linux driver. 8. Install and uninstall Linux drivers.

Android Driver Development Sixth chapter notes

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.