In awk,! a [$0] + + and! a [$1.] + +
To understand the difference between the functions of! a [$0] + + and! a [$1] + + and the difference between them, we should understand the following two points: 1.A [$0] is undefined, that is, undef 2.! Priority is higher than +
Based on the above two points, there are the following examples:] + + and! a [http://img2.ph.126.net/pLiASpYRWzQDqAfq4WdCwA==/2868792962652662006.jpg...]++">
1. Retrieva [$0] +! a [$0] + + can remove duplicate records in a row and index the records as an array (which can be understood as an array); based on the above two points, this is not difficult to understand. The examples are as follows] + + and! a [http://img1.ph.126.net/fQ982Kq0nUb3EYG53WkXuw==/649362771289050004.jpg...]++"> can see from the above example that duplicate records are deleted and only the records that appear for the first time in the duplicate records are retained.
2.Secreta [$1] + or! a [$2] + + and so on! a [$1] + + can delete the same record in this domain according to a field in the record, or perform some other corresponding operations based on the same domain. The examples are as follows:] + + and! a [http://img1.ph.126.net/rc4VO4XgGDvPf45VSuSYOQ==/977281119156469150.jpg...]++"> can see from the above example that multiple records with the same second domain are deleted, leaving only the records that appear for the first time in the duplicate records.
Example: 1. There are multiple duplicate records in the file, showing only one of the duplicate records] + + and! a [http://img0.ph.126.net/elx1pl6ZnjjmQvjtUYJn1g==/2834171540517331086.jpg...]++">
two。 Count (by record) the number of occurrences of each record in the file] + + and! a [http://img0.ph.126.net/JMAOxuC3i-0-VFjtFkad0A==/1168684103320298760.jpg...]++"> as shown in the above figure, according to the number of occurrences of each record in the record statistics file
two。 Count the number of times a domain appears in a file (by domain). Sometimes it is possible to count the number of times an IP visits a website according to the IP address in the log] + + and! a [http://img0.ph.126.net/adrs5ZR3qe1du_xZB-gvgg==/2395915001778831717.jpg...]++">