Bash compare lines in two files


















The Overflow Blog. Podcast Helping communities build their own LTE networks. Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Related Hot Network Questions. Question feed. While I have tried using wc -l in the comparison, I'm struggling to get it working properly.

Update: We found that the wc -l command must return a digit only for the comparison. Unlike the question Why should there be a space after '[' and before ']' in Bash? Now since we could see number of lines are not equal in both the files so following result will come.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.

Asked 4 years, 3 months ago. You can use grep : grep -f file1. Rubens Rubens Thanks, this also works: sort file1. Alessandro Alessandro 2, 2 2 gold badges 14 14 silver badges 13 13 bronze badges. The Overflow Blog. Podcast Helping communities build their own LTE networks.

Podcast Making Agile work for data science. Featured on Meta. By including that, we don't have to discuss whether versions of OSs and utilitiies differ. There was an export missing, thanks for noticing that. I still don't understand the comment. What's an "external user", and why would you want to set the path for a script that is pure bash? We write code for our shop, so the path settings may differ for external users. We add that if it appears necessary to omit our settings.

This is a template that is modified to display the information about the environment in which the code was executed. If it would be transformed into a production code, say for clients, instead of a demo code, we'd want to be sure that none of our local paths are used. The command line for context is designed so that if that file is not found nothing will happen, not even an error, but no versions would be listed.

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks. Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.



0コメント

  • 1000 / 1000