- MCP server with stdio transport for local use - Search episodes, transcripts, hosts, and series - 4,511 episodes with metadata and transcripts - Data loader with in-memory JSON storage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
3.5 KiB
Plaintext
51 lines
3.5 KiB
Plaintext
Episode: 3889
|
|
Title: HPR3889: comm - compare two sorted files line by line
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3889/hpr3889.mp3
|
|
Transcribed: 2025-10-25 07:29:45
|
|
|
|
---
|
|
|
|
This is Hacker Public Radio Episode 3889 for Thursday, 29 June 2023.
|
|
Today's show is entitled, Come Compare Two Sorted Files Line by Line.
|
|
It is hosted by Ken Fallon and is about three minutes long.
|
|
It carries a clean flag.
|
|
The summary is, a great tool to quickly find the differences between two files.
|
|
Hi everybody, my name is Ken Fallon and you're listening to another episode of Hacker Public Radio.
|
|
Today I want to share with you a little command line tool that I've been using very often recently.
|
|
It was shown to me by my boss on work and it is called Come.
|
|
C-O-M-M, I'm from the man page.
|
|
It says Compare Two Sorted Files Line by Line.
|
|
The sorted is very important there.
|
|
And it's part of the Core Util Packages, which you can install on Fedora Red Hat Systems using DNF Install Core Utils all more word.
|
|
And on Debian apt install Core Utils all one word.
|
|
I'll read you a little bit of the man file here to get us going.
|
|
So it's come space and then options and then the first file and the second file.
|
|
So you compare sorted files, file one and file two line by line.
|
|
When file one or file two, not both is dash read from standard input.
|
|
With no options produces three column output column one contains lines unique to file one column two contains lines unique to file two and column three contains lines common to both files.
|
|
So that's the standard.
|
|
But what you can also do is you can use the options dash one dash two and dash three and dash one will suppress column one showing only the lines unique to file one.
|
|
And column dash two will suppress column two showing only those unique to file two.
|
|
So there are some other options, but I always found it a little bit confusing.
|
|
So it's a lot easier just to create two different files.
|
|
The first file having the number one on the first line and the number two and the second line.
|
|
And I called that on imaginatively one and two dot text and then I created another file called two and three dot text.
|
|
And I have the number two on the first line and the number three on the first line.
|
|
So if you run that command with come space dash one space dash two using one and two dot text and two and three dot text you get the number two.
|
|
So that's showing you the ones that are common to both.
|
|
So what's left over is line three.
|
|
If you do come dash one come dash two you get the number three, which makes sense.
|
|
So this is in the show notes and it is an extremely useful file for comparing.
|
|
Yeah, I don't know, for example, hypothetically speaking if you were moving a server from one location to another and you wanted to make sure you have all the files.
|
|
You can sort the text from the name of all the files from one and against two and very quickly get an output.
|
|
So that's it.
|
|
Feel free to send in some shows.
|
|
And we are now able to add to the reserve queue.
|
|
So feel free to do that.
|
|
And tune in tomorrow for another exciting episode of Hacker Public Radio.
|
|
You have been listening to Hacker Public Radio at Hacker Public Radio does work.
|
|
Today's show was contributed by a HBR listener like yourself.
|
|
If you ever thought of recording podcasts, you click on our contribute link to find out how easy it really is.
|
|
Hosting for HBR has been kindly provided by an honesthost.com, the internet archive and our sings.net.
|
|
On the Sadois status, today's show is released under Creative Commons, Attribution 4.0 International License.
|