ls - wildcards and global use


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ls - wildcards and global use
# 1  
Old 12-07-2001
ls - wildcards and global use

Hiya,

I want to list all files missing a certain pattern and/or filename pattern on the entire drive.

In DOS I would type (for instance):

dir \t*.doc /s /a

which should find all doc files whose filename starts with `t'.

How do I do that in a unix shell? Can it be done w/ ls at all? I don't seem to succeed, I've read the man pages, but either I don't understand them correctly or it's not doing what it's supposed to do. For instance: I've tried: ls -AFR com.* from root dir, and it doesn't find stuff in subfolders.
(Ok, you got me, I'm a unix newbie.)

uses:
Mac OS X
tcsh

I'm looking for a solution that would work with most shells, sh, csh, tcsh, bash, you name it.


Also, the man pages frequently mention I can press tab or esc x 2 for choice/filename/dirname completion, but that doesn't seem to work on my (default Mac OS X terminal) tcsh either?

cheers,

the rop
ropers
# 2  
Old 12-07-2001
find / -name "search string here" -print
# 3  
Old 12-07-2001
Hm, alroight. Cool. But what's the story w/ ls -R? I don't really get it why it doesn't seem to recurse subdirs as that is what it says it does?
ropers
# 4  
Old 12-07-2001
I don't know why your "ls -R" doesn't work unless you are
doing...

ls -R t*

...which if no files in the current directory are found that
match, you'll get...

ls: t*: No such file or directory

...you can do this...

ls -R | grep "^t"

...which will list every file that begins with the letter "t"
but the "find" command is much better suited for this
as Optimus_P pointed out.
# 5  
Old 12-07-2001
Greetings all,

I couldn't figure out a way to find a filename that matches 2 wildcards using one command, so this works but there must be a better way. Hopefully someone will post it.

Anyway you could use:
find / -name t* -print > /anyfile

Pipes all files that begin with t
into a file and then use grep to search the file named /anything.

grep .doc$ /anything

Hope this helps until something better is posted.
# 6  
Old 12-07-2001
Checked the man pages and found some good stuff. Much better.

find / -name t* -name *.doc -print

Don't actually need to specify the
-print option. Assuming it is the default.At least on my set up.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Date and time change in global and non global zone

Hi, If I change date and time in global zone, then it will affect in non global zones. During this process what files will get affect in non global zones and which mechanism it's using to change. gloabl zone:Solaris 11.3 X86 TIA (1 Reply)
Discussion started by: Sumanthsv
1 Replies

2. Solaris

Global and non-global zone resource sharing - tricky

hi all, Just a simple question but i cant get the answers in the book - In my globalzone , assuming i have 4 cpus (psrinfo -pv = 0-3), if i set dedicated-cpu (ncpus=2) for my local zone Is my globalzone left with 2 cpus or still 4 cpus ? Does localzone "resource reservation.e.g. cpu in... (6 Replies)
Discussion started by: javanoob
6 Replies

3. Shell Programming and Scripting

Why global var is not global with export

Hi, I try to define global var assuming that I can acces it from multiple sessions/terminal windows, but I can't do this with either comand line or script delcaratino/export. I'm not a root user doing this, but is this should not be matter. Even if I do this lines below in script, being in the... (3 Replies)
Discussion started by: trento17
3 Replies

4. Solaris

How to identify a global or non-global Solaris server?

Hi, I have Solaris zone configured with Solaris 9 and 10. In Solaris 10(non global), I use the command “zonename” to get whether it is global or non-global server. For Solaris 9, what command I can use to get whether it is global or non-global server. Regards, Kalai :confused: (25 Replies)
Discussion started by: kalpeer
25 Replies

5. Solaris

How to see global hostname by logging in non global zones?

Hi guru Could any one help me by letting me know, how to see global hostname by logging in non global zones Regards (2 Replies)
Discussion started by: girish.batra
2 Replies

6. Solaris

How to access ENV variables of non global zones in global zone???

Hi Guys, My requirement is I have file called /opt/orahome/.profile in non global zone. PATH=/usr/bin:/usr/ucb:/etc:/usr/sbin:/usr/local/bin:/usr/openwin/bin:. export PATH PS1="\${ORACLE_SID}:`hostname`:\$PWD$ " export PS1 EDITOR=vi export EDITOR ENV=/opt/orahome/.kshrc export ENV... (1 Reply)
Discussion started by: vijaysachin
1 Replies

7. Solaris

Is there two different kernel`s running in global and non global zone?

Hi All, I want to know for non global zone there will be different kernal running? (1 Reply)
Discussion started by: vijaysachin
1 Replies

8. Solaris

How can we copy a directory from Global to Non-global zone?

Hi All, How can we copy a directory from global zone to non-global zone using SCP command? (8 Replies)
Discussion started by: vijaysachin
8 Replies

9. Solaris

[b]How to mount a folder from global zone to non global zone??

Hi All There is one folder in global zone I just want to share the same folder innon global zone. How can i do it? pls send me script for this. (2 Replies)
Discussion started by: vijaysachin
2 Replies

10. Solaris

How to know the global zonename from non-global zone?

It is easy to list all zones from global zones, but how to find out the global zone name from non-global zone? thx (11 Replies)
Discussion started by: honglus
11 Replies
Login or Register to Ask a Question