Display file name

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
    I have a directory called "Month" which has 12 files named on months.

/home/months> touch Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

I need to display the list of file from Jan to Jun (using sed or grep)?

  1. Relevant commands, code, scripts, algorithms:

NA

  1. The attempts at a solution (include all code and scripts):

NA

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    Amity,Noida,India, Sanjeev Thakur, MCA

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

We won't do your homework for you, so unless you show some effort and tell us what you've tried so far we won't support any cheating on your part.

Ok... fine...but I am not getting anything in my mind.... Please provide me some hint, so I can try to think about it....

why dont you write the logic in your own english words ( step by step )
then, we see what are the commands we can use it to achieve your output

Try reading the man pages on sed and grep. It is not as hard as you think. You can use the | (pipe) command.

I guess

cat Jan Feb Mar Apr Mar Jun Jul

is out of question, right? :wall:

Well, why don't you create an environmental variable with the contents "Jan Feb ... Dec". That will make your life much easier.
Then you can play with "cut" command. You can set the field range of 1-6, be sure to define the delimiter to space (quote it) and if you need the contents of the files, backquote them to a cat command.

That's fast and dirty.

If you need something more elaborate, consider using an interpreted language that supports hash tables (dictionaries) like perl or python.
Something like
{'Jan':1, 'Feb':2, ... 'Dec':12 }
And sort it by value.

Hope that helps.

Here you have shared shared good and helpful information for need people. Keep it up always.