How to list file names with a total of X letters

Sammy Guergachi

Say I have a list of the following files in my current dir:

lab1.jav mytst2 pie.c prog2.c tst3.ex tst5:5.tlab2jav lab2jav.ext new.c prog1.c tst1 tst4.exc tst6:6123.tA7-tst.c fred.txt

And I need to list the files with a total of say 7 letters for example. How would you do this? I tried to no avail:

ls | egrep -i '[a-z]{7}'

I think it's because the dots are in the way, is there a simple way of doing this?

Pilot6

It can be done this way:

ls | grep -E '^(\W*[0-9]*[a-zA-Z]){7}\W*[0-9]*$'

This includes cases when the first and the last character is a digit or a non alphanumeric char.

Or shorter

ls | grep -Ei '^([^a-z]*[a-z]){7}[^a-z]*$'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to remove the first 2 letters of multiple file names in linux shell?

From Dev

Python 3.x - writing generated letters as list to a text file

From Dev

How to execute command on list of file names in a file?

From Dev

How to list directories names but not their contents, in *N*X?

From Dev

How to list only the file names in HDFS

From Dev

How to build a list of file names in a local directory?

From Dev

How to list all file names in terminal?

From Dev

PHP get names in a file after letters name:

From Dev

How to query for file names starting with specific combinations of letters on foobar2000?

From Dev

How to write a file list with foreign names to a csv file in the terminal?

From Dev

How to pass a list of file names to xargs after checking if the file exists?

From Dev

How can i get a list of total sums based off names in a table and their points (from column)?

From Dev

How to get a list of valid X11 names for characters

From Dev

Bat file list file names

From Dev

File Revision List File Names?

From Dev

how to substitute the beginning of file names in Mac OS X?

From Dev

How can I sort a list of file names by some substring of the name?

From Java

How to list only the file names that changed between two commits?

From Dev

How do I sort a list of file names in the Windows command prompt?

From Dev

How to get list of file names from a private remote ip

From Dev

how to separate a list of names in a text file separated by a space

From Dev

How to list only the file names and not its attributes in a directory( in Linux)?

From Dev

How to extract Excel file header names into array list using POI?

From Dev

How can I sort a list of file names by some substring of the name?

From Dev

How do I list file names on a server in a directory?

From Dev

How to list file names on Windows as the Unix find command?

From Dev

How to get list of file names and their sentence containing a specific search string?

From Dev

How to list only the file names of the same type in the directory?

From Dev

How to delete files from a folder using a list of file names in windows?

Related Related

  1. 1

    How to remove the first 2 letters of multiple file names in linux shell?

  2. 2

    Python 3.x - writing generated letters as list to a text file

  3. 3

    How to execute command on list of file names in a file?

  4. 4

    How to list directories names but not their contents, in *N*X?

  5. 5

    How to list only the file names in HDFS

  6. 6

    How to build a list of file names in a local directory?

  7. 7

    How to list all file names in terminal?

  8. 8

    PHP get names in a file after letters name:

  9. 9

    How to query for file names starting with specific combinations of letters on foobar2000?

  10. 10

    How to write a file list with foreign names to a csv file in the terminal?

  11. 11

    How to pass a list of file names to xargs after checking if the file exists?

  12. 12

    How can i get a list of total sums based off names in a table and their points (from column)?

  13. 13

    How to get a list of valid X11 names for characters

  14. 14

    Bat file list file names

  15. 15

    File Revision List File Names?

  16. 16

    how to substitute the beginning of file names in Mac OS X?

  17. 17

    How can I sort a list of file names by some substring of the name?

  18. 18

    How to list only the file names that changed between two commits?

  19. 19

    How do I sort a list of file names in the Windows command prompt?

  20. 20

    How to get list of file names from a private remote ip

  21. 21

    how to separate a list of names in a text file separated by a space

  22. 22

    How to list only the file names and not its attributes in a directory( in Linux)?

  23. 23

    How to extract Excel file header names into array list using POI?

  24. 24

    How can I sort a list of file names by some substring of the name?

  25. 25

    How do I list file names on a server in a directory?

  26. 26

    How to list file names on Windows as the Unix find command?

  27. 27

    How to get list of file names and their sentence containing a specific search string?

  28. 28

    How to list only the file names of the same type in the directory?

  29. 29

    How to delete files from a folder using a list of file names in windows?

HotTag

Archive