Solved

Solaris find files in directory that don't start with T or P

Posted on 2007-11-21
6
757 Views
Last Modified: 2013-12-27
Hi
Can I use the unix find command to find files in a directory that DONT start with either a T or P
Thanks


0
Comment
Question by:daveyu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
ID: 20327758
Hi,

If I got your question correct, then try

find /dir -name "[!PT]*"
0
 
LVL 6

Expert Comment

by:Talmash
ID: 20327954
!P might be aliased to the last command started with P (and probably will return: PT: Event not found)

find <dir> -type f | grep -v '/P' | grep -v '/T'

you may add -maxdepth 1, BEFORE  "-type f" for search NOT in subdirectories

tal
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20328016
Hi,

Talmash:

Which shell that will go into the "[!PT*]" to subistitue a last command?

Did you try it?

Thanks
0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 62

Expert Comment

by:gheist
ID: 20330196
Please explain your logic - has directory name to not begin with TP or filename? Do you need diving into subdirs?
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20330624
Talmash.

I echo the comments of omarfarid.  While it's true that if your shell is bash and you use ! in some commands, eg: sed, bash will interpret this as the history recall function, but in the command omarfarid gave, this isn't the case.

Additionally, Solaris find doesn't support the -maxdepth option.  

One final point, on systems that do have GNU find, it's not important where the -maxdepth option is specified.  It certainly doesn't have to go before -type f

:-)
0
 
LVL 9

Expert Comment

by:Murugesan Nagarajan
ID: 20598264
find command usage at "ksh" shell at the following platforms:
Linux
      find $PWD -type f -regex  ".[^T|P]*"
AIX
      find $PWD -type f \( -name "[!T|P]*" \)
HP-UX
      find $PWD -type f \( -name "[!T|P]*" \)
SunOS
      find $PWD -type f \( -name "[!T|P]*" \)
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question