I would like to ask you a question about the comparison of file content and number of lines

Source: Internet
Author: User
I would like to ask you a question about the comparison of file content and number of lines-Linux general technology-Linux technology and application information. The following is a detailed description. Hello everyone, I have two files: 1. SQL and 2. SQL, which are
1. SQL: This file contains only some records. All I need is the number of its rows, as shown in the following nine rows:
1
2
3
4
5
6
7
8
9
2. SQL: this file is only a log that records various information, including 1. the SQL file contains several rows of correct and error information, and the error message:
Fdfkdj
Aa 1
9 is 1. SQL
Bb 2
Cc 3
14 is 1. SQL
Dd 4
Ee 5
Error
End
Now I want the result in 2. in the SQL file. the SQL file is the same as the string, and then the numbers before these strings are extracted with 1. compare the number of SQL rows in three cases:
1. the strings and numbers in the same row in SQL are exactly the same as those in 1. the SQL file name and record number are output correctly.
2. the strings in the same row in SQL are the same as those in the 1. SQL file name, but the numbers and records are different. The output is incorrect.
3. As long as an error occurs in file 2. SQL, an error is output directly, and no subsequent decisions are required.

What I can do now is
Find File Name and number of file lines
Awk '/1. SQL/{print $1, $3}' 2. SQL
Query the number of objects
Line = 'wc-l 1. SQL | awk '{print $1 }''

But we can't link them up. You can see if there is any way. Thank you.
Related Article

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.