Jump to content

finding and deleting duplicate lines from a txt file


Recommended Posts

Posted

Would it be possible to have Autolisp read a txt file and delete all duplicate files?

 

I know that doesn't require necessarily autolisp but the values in the file come from an Autolisp routine and I though I could integrate it so that I can have the file ready with not duplicates.

 

Any ideas would be appreciated.

Posted

Yes, please look into the (vl-remove-if-not) functions.

Here are a couple examples a quick google search turned up

 

http://forums.augi.com/showthread.php?29269-Delete-Duplicate-Text-in-the-same-object

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/How-to-find-duplicate-text-string/td-p/1990898

 

(post following is from someone much smarter, I was just trying to be of assistance)

Posted

If the content of said file comes from an AutoLISP routine, then may easily integrate a code to store the lines into a list and use MEMBER function to validate if a line isn't already there and therefore shoudn't be added again.

Posted

MSasu thank you for letting me know the member command. It worked perfectly making as you said a list and use of member command. Thank you.

Posted

Sound good MJLM; you're entirely welcome!

One observation for the sake of conformity, is about a function and not a command.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...