Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am looking for a text compare program/script that basically compares white spaces. In other words; Are two files formatted the same even if the data in the various fields is different between the two files? I have looked at sed , awk, diff, cmp and several forums to try to locate such a tool but have been unsuccessful so far.
The details are that I have an automated process that generates a EDI transmittal file containing invoice details (price, manufacturer and product numbers, volumes, order number, quantity,etc. This file is sent to customer for payment. Occasionally there is a need to perform some manual manipulations to the file and I want to be able to compare the changed one to an untouched "properly formatted" one to see that the manual changes were performed properly (at least in regard to formatting)?
Thanks in advance.
It sounds like you have some programming chops, I'd reccomend looking at Regular Expressions for what you want. As for what kind of script, I'd say Perl myself but I'm biased towards it and not really aware of what might work best. With RegXs you could specify it to look for specific layouts of white space and new lines
I'm pretty sure Bash shell scripts will support regular expressions in addition to several of the Linux utilities...anyone else, yay, nay?
I'd probably go with perl too. What are you trying to compare - just blank lines or white space in other lines too? We could probably whip up a quick example if you can post a couple of example files, ie the before and after.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.