What is the command for listing all files end

December 5, 2010 at 04:46:02
Specs: Linux i686
Create the following files: chapa, chapb, chapc, chapd, chape, chapA, chapB, chapC, chapD, chapE, chap01, chap02, chap03, chap04, chap05, chap11, chap12, chap13, chap14, and chap15.

What is the command for listing all files ending in small letters?
What is the command for listing all files ending in capitals?
What is the command for listing all files which end in small letters but not ‘a’ and ‘c’?
What is the command for listing all files whose last but one character is 0?

please reply me thanks in advance


See More: What is the command for listing all files end

Report •

#1
December 5, 2010 at 09:45:35
Sorry, but no one on this forum is going to do your homework for you. If you understand Linux wildcards you should have no trouble with these questions. If you don't, then you have some studying to do.

Report •

#2
December 6, 2010 at 23:40:57
Just to expand on what L Miller stated. It is very easy for an instructor to use a search engine and find out where you got your answer.

I'll provide you a minor hint. Look at pattern matching. Works with the command that lists files.


Report •

#3
December 15, 2010 at 21:59:42
Here are the solutions:

What is the command for listing all files ending in small letters?
ls | egrep [a-z]$

What is the command for listing all files ending in capitals?
ls | egrep [A-Z]$

What is the command for listing all files which end in small letters but not ‘a’ and ‘c’?
ls | egrep [a-z]$ | egrep -v [a]$ | egrep -v [c]$

I'm sorry. I didn't get the last question.


Report •

Related Solutions

#4
December 16, 2010 at 03:25:49
Why use the ls command and pipe to egrep? The ls command allows pattern matching.

Four commands to list files ending in small letters but not a or c? What's wrong with:

ls *[bd-z]

Another question. Didn't you notice that the contributors to this forum refuse to post answers to homework assignments? And if you are going to do homework assignments, at least give better solutions than these. I'd be embarrassed to use them in any script I wrote.


Report •

Ask Question