473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to list only files (not path) in directory with .pl extension

Hi, I'm trying to list files in a different directory based on a specific criteria.
The directory is in Dir1 and I'm in HOME.
I would like to only list files that end in .pl

However, I do not want to include the file path in the result.

In short, I want to ls Dir1 but only list file names that end in .pl.


Any suggestions?
Apr 4 '13 #1
2 1586
sicarie
4,677 Expert Mod 4TB
Move into the directory first, then list

Expand|Select|Wrap|Line Numbers
  1. cd Dir1; ls *.pl
  2.  
Apr 5 '13 #2
Nepomuk
3,112 Expert 2GB
You can automatically move back to the previous directory with the following line of commands:
Expand|Select|Wrap|Line Numbers
  1. PWD_old=`pwd`; cd Dir1; ls *.pl; cd $PWD_old
Apr 29 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
54
by: seberino | last post by:
Many people I know ask why Python does slicing the way it does..... Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring gives me elements 0, 1, 2 and 3...
1
by: James White | last post by:
I have a young nephew who appears to be developing into a natural geek/nerd/guru/whatever and as he learns I need to make sure that he stays on the side of the white hats, rather than going down...
1
by: Manuel11g | last post by:
Hello, I am a new programmer in Python and a need some help. Where can i get a basic tutorial about Class. I don't know nothing about Object Oriented Programming. Can you help me?
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
6
by: Simon Walsh | last post by:
I'm an Electronics student in college and I'm currently working on a project. I was given a circuit diagram for my project, from which I had to design a printed circuit board to be sent off and...
28
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of...
1
Lokean
by: Lokean | last post by:
Hi. I have a vb.net program that hits a database and returns a dataset which I use in a datagrid for display purposes. I also want to output the dataset to a crystal report. I have used the...
1
by: Tony Johansson | last post by:
Hello! I'm reading a book and I'm trying to learn the very basic about xml. Can somebody give me an explanation why namespace are used in xml perhaps with a simple example that demonstate the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.