Skip to main content
suggestion from steeldriver
Source Link
steve
  • 22.4k
  • 5
  • 53
  • 79

This works. ^ denotes start of line, plus the {32} you already had, then a $ for end of line.

$ cat fileA fileB 12345678901234567890123456789012 123456789012345678901234567890123 12345678901234567890123456789012 123456789012345678901234567890124 $ grep -E "^.{32}$" fileA fileB fileA:12345678901234567890123456789012 fileB:12345678901234567890123456789012 $ 

And as pointed out by @steeldriver, posix grep includes -x, so the following approach also works : grep -xE ".{32}" fileA fileB

This works. ^ denotes start of line, plus the {32} you already had, then a $ for end of line.

$ cat fileA fileB 12345678901234567890123456789012 123456789012345678901234567890123 12345678901234567890123456789012 123456789012345678901234567890124 $ grep -E "^.{32}$" fileA fileB fileA:12345678901234567890123456789012 fileB:12345678901234567890123456789012 $ 

This works. ^ denotes start of line, plus the {32} you already had, then a $ for end of line.

$ cat fileA fileB 12345678901234567890123456789012 123456789012345678901234567890123 12345678901234567890123456789012 123456789012345678901234567890124 $ grep -E "^.{32}$" fileA fileB fileA:12345678901234567890123456789012 fileB:12345678901234567890123456789012 $ 

And as pointed out by @steeldriver, posix grep includes -x, so the following approach also works : grep -xE ".{32}" fileA fileB

Source Link
steve
  • 22.4k
  • 5
  • 53
  • 79

This works. ^ denotes start of line, plus the {32} you already had, then a $ for end of line.

$ cat fileA fileB 12345678901234567890123456789012 123456789012345678901234567890123 12345678901234567890123456789012 123456789012345678901234567890124 $ grep -E "^.{32}$" fileA fileB fileA:12345678901234567890123456789012 fileB:12345678901234567890123456789012 $