Home Download Buy Blog Forum Support

Subtract one file from another

Subtract one file from another

Postby GianlucaSavini on Mon Feb 04, 2013 5:05 pm

Hello everybody, I'm quite new to ST.

I have to delete lines (mail addresses) from one file from another file. The FileDiff Package can make the differences visible, but cannot subtract one file from onother.

Any idea to do this?

Thanks in advance!
Posts: 1
Joined: Mon Feb 04, 2013 5:03 pm

Re: Subtract one file from another

Postby jps on Wed Feb 06, 2013 1:57 am

The following technique assumes you have two files, each of which has one email address per line. It also assumes neither list has any duplicates.

Firstly, take the list of email addresses to be deleted, and append it to the bottom of the list of all email addresses. Now sort the file (via Edit/Sort Lines). You should have one file, with all the emails that need to be deleted having two entries next to each other.

You can find all repeated lines using this regex:

Code: Select all

Open the Find panel, turn on the Regex flag (the .* button), then press Find All: all duplicated lines should now be selected, and you can simply delete them.
Site Admin
Posts: 3217
Joined: Wed Mar 19, 2008 12:33 pm

Re: Subtract one file from another

Postby highend on Wed Feb 06, 2013 8:35 pm

Nice trick to delete duplicate lines :)
Posts: 95
Joined: Fri Jan 20, 2012 2:47 pm

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 24 guests