|
Home > Archive > Unix Shell > January 2007 > filter out files when ls command is used
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
filter out files when ls command is used
|
|
| Petterson Mikael 2007-01-29, 7:19 am |
| Hi,
When I run the ls command I want to "filter" out files that is not to be
included in when making operations to the files. Any idea how I can to
that. These files shall not be included:
XTInput.java XPInput.java XRInput.jav XEInput.java
The ones to be filtered out are these for the moment but will change in
the future.
cheers,
//mikael
| |
| Radoulov, Dimitre 2007-01-29, 7:19 am |
|
"Petterson Mikael" wrote ...
[...]
> When I run the ls command I want to "filter" out files that is not to be
> included in when making operations to the files. Any idea how I can to
> that. These files shall not be included:
>
> XTInput.java XPInput.java XRInput.jav XEInput.java
[...]
ksh
ls !(X[EPRT]Input.jav?(a))
bash
shopt -s extglob
ls !(X[EPRT]Input.jav?(a))
Regards
Dimitre
| |
| ramesh.lakshminarayana@gmail.com 2007-01-29, 1:17 pm |
|
You can actually do this
ls -l |grep -v 'Input'
this might also stop all the files containing 'Input', if you have
other than the mentioned files.
ls -l |grep -v ' XTInput.java'|grep -v 'XPInput.java' |grep -v
'XRInput.jav' |grep -v 'XEInput.java'
This will certainly not include the below mentioned files.
Ramesh Lakshmi
On Jan 29, 4:18 am, Petterson Mikael
<mikael.petter...@era.ericsson.se> wrote:
> Hi,
>
> When I run the ls command I want to "filter" out files that is not to be
> included in when making operations to the files. Any idea how I can to
> that. These files shall not be included:
>
> XTInput.java XPInput.java XRInput.jav XEInput.java
>
> The ones to be filtered out are these for the moment but will change in
> the future.
>
> cheers,
>
> //mikael
|
|
|
|
|