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
880 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
 
LVL 11

Expert Comment

by:acseven
ID: 12042840
the active file compare tool is for windows, though there are more tools like that...
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article shows how to convert a multi-page PDF file into multiple image files, with one image file created for each page of the PDF. It does this by utilizing an excellent, free software package called GraphicsMagick. The solution is amazingly s…
A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

747 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now