# How can I print only the lines for a file that contain consecutive digits?

I have a text file containing a list of numbers. I want to print only the lines that contain a number, the digits of which are consecutive digits.

The input list:

123
321
567
765
124
568

The output should be:

123
321
567
765

• Pick and Cases could do the job? Oct 24 '18 at 17:33

consecutive = Total[Abs[Differences[IntegerDigits@FromDigits@#]] - 1] &;