Solved

How do you: 1) compare two ASCII files line by line, 2) switch the position of surnames & first names

Posted on 2004-09-13
11
886 Views
Last Modified: 2010-08-05
I have a regular function to carry out whereby firstly I need to:

1) compare two ASCII files line by line, searching for differences, possibly marking them, or even better removing them them reporting back a further list of removals.

2) In another ASCII list, switch the position of surnames & first names and output a new list.

How can I achieve this, is there one or two items of software out there that will assist?

Many thanks
0
Comment
Question by:bigstar
  • 2
  • 2
  • 2
  • +1
11 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 12042533
Hi bigstar,

> 1) compare two ASCII files line by line, searching for differences, possibly marking them,
> or even better removing them them reporting back a further list of removals.
search for a tool called "diff" .. Its a standard unix utility which does exactly that ...

> 2) In another ASCII list, switch the position of surnames & first names and output a new list.
Another unix utility called "awk" can do that in one line ... post the format of the file

You did not post your platform ... If you are not on a *nix, try searching for a port of these utilities for your platform.

Sunnycoder
0
 
LVL 11

Expert Comment

by:acseven
ID: 12042802
Hi,

1) check this one: Active File Compare (http://www.formulasoft.com)

2) you could import the list to excel, with the name detection made by an empty space, switch the columns in excel, and then export back to txt with a space in between names
0
 

Author Comment

by:bigstar
ID: 12042813
Hi Sunnycoder,

Apologies, I should have stated the platform I'm using. It's Windows and specifically Win XP Pro.

I'll search for windows equivalents, but if you are able to do the same I'd appreciate it.

Thanks
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 11

Expert Comment

by:acseven
ID: 12042840
the active file compare tool is for windows, though there are more tools like that...
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 12042916
0
 

Accepted Solution

by:
Dinq earned 100 total points
ID: 12090354
TextPad helps me a lot when working with text files, and it will do a line by line compare, with options to not show differences based on white space (extra spaces or tabs) and will then autogenerate a separate document with the differences noted.

As for switching the names, excel is a good idea (download and use openoffice.org if you don't have excel)

Open the file in excel and import it as a delimited text file.  Hopefully there is a comma between the first and last(sur)names in your original text file.  If not, you might have to work with fixed width delimited (if the text file contains columns of data or tabs).

Then in excel (or open office) you will eventually get your firstname in one column and your surname in another column.  Just "cut" whichever column you want to move, and "paste" it back in the order you want.

Finally, if you need it back in txt format, just save it in the original format.

G'Luck

Dinq
0
 

Author Comment

by:bigstar
ID: 12091326
Hi, thanks for all the responses.

I've had to put this on hold for a few days, but I have tried the excel switching option, which worked great.

Where can I get 'Textpad'?
0
 

Expert Comment

by:Dinq
ID: 12118088
www.textpad.com

sorry I didn't include that.

Evaluation version available, last time I checked it's fully enabled so you can try it out for everything you might want to do.

Only $29.50 USD for a full license.

Dinq
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The viewer will learn how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question