Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-29 Thread Michael Ewan
There is also meld (graphical) that allows you to view changes and also apply one side or the other. On Wed, Dec 28, 2022 at 11:15 PM wrote: > On Wed, 28 Dec 2022 16:38:50 + > Ben Koenig wrote: > > > > > Diff could definitely work here but comm seems to directly address what > I want

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-28 Thread briand
On Wed, 28 Dec 2022 16:38:50 + Ben Koenig wrote: > > Diff could definitely work here but comm seems to directly address what I > want without any fancy formatting. I was able to slide comm into my shell > script and didn't need to add much complexity. > > I'm going with the butter knife

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-28 Thread Ben Koenig
--- Original Message --- On Tuesday, December 27th, 2022 at 3:37 PM, bri...@pounceofcats.com wrote: > On Tue, 27 Dec 2022 22:06:18 + > Ben Koenig techkoe...@protonmail.com wrote: > > > Diff essentially does what I want, but it adds a bunch of other stuff. I > > haven't found a

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread briand
On Tue, 27 Dec 2022 22:06:18 + Ben Koenig wrote: > Diff essentially does what I want, but it adds a bunch of other stuff. I > haven't found a set of options to tell to simply the output. Here's an > example: > Study the man page. diff has options which allow you to override the behavior

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Reid
Sent with Proton Mail secure email. --- Original Message --- On Tuesday, December 27th, 2022 at 2:10 PM, Rich Shepard wrote: > On Tue, 27 Dec 2022, Reid wrote: > > > You could try something like `diff --changed-group-format='%<' > > --unchanged-group-format=''`, or one of its

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Rich Shepard
On Tue, 27 Dec 2022, Ben Koenig wrote: Ha, I knew one of these GNU tools could do it! I nearly gave myself a migraine struggling to remember which command did this. I kept landing on cmp but it works byte-for-byte. I use comm when downloading a permit database as a .csv file and want to

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Ben Koenig
Ha, I knew one of these GNU tools could do it! I nearly gave myself a migraine struggling to remember which command did this. I kept landing on cmp but it works byte-for-byte. For the example above, just do: bash-5.1$ comm -1 -3 a.csv b.csv 2,m 4,d 5,e 6,f And Bob's (literally) my uncle.

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Rich Shepard
On Tue, 27 Dec 2022, Reid wrote: You could try something like `diff --changed-group-format='%<' --unchanged-group-format=''`, or one of its variants. That example assumes that the first file is the one you want lines from. Check the diff man page under "--GTYPE-group-format=GFMT". diff -y

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Ben Koenig
Diff essentially does what I want, but it adds a bunch of other stuff. I haven't found a set of options to tell to simply the output. Here's an example: -a.csv- 1,a 2,b 3,c -b.csv- 1,a 2,m 3,c 4,d 5,e 6,f Diff gives me the following: bash-5.1$ diff a.csv b.csv 2c2 < 2,b --- > 2,m 3a4,6 > 4,d

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Reid
Sent with Proton Mail secure email. --- Original Message --- On Tuesday, December 27th, 2022 at 1:46 PM, Vince Winter wrote: > Define strange stuff from diff? > > On Tue, Dec 27, 2022, 13:35 Ben Koenig techkoe...@protonmail.com wrote: > > > Hi all, > > > > I thought there was

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Robert Citek
Can you give an example of what you've tried and what you would like the expected outcome to be? Here's a quick sample showing lines 4 and 5 have been added: $ diff <( seq 1 3 ) <( seq 1 5 ) 3a4,5 > 4 > 5 Regards, - Robert On Tue, Dec 27, 2022 at 2:35 PM Ben Koenig wrote: > Hi all, > > I

Re: [PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Vince Winter
Define strange stuff from diff? On Tue, Dec 27, 2022, 13:35 Ben Koenig wrote: > Hi all, > > I thought there was a command to do this but I'm having trouble finding it > and diff is doing strange stuff. > > I have a csv file that grows over time. What I want to do is take a newer > version of

[PLUG] Comparing 2 files and printing lines that are different

2022-12-27 Thread Ben Koenig
Hi all, I thought there was a command to do this but I'm having trouble finding it and diff is doing strange stuff. I have a csv file that grows over time. What I want to do is take a newer version of the file, compare it to the old one, and only print the lines that are different. This also