08-30-2011
find the file names having specified pattern at specified position in the current directory
I would need a command for finding first 15000 of the file names whose 25th postion is 5 in the current directory alone.
I do have this painful command
find . -name '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]5*' | head -15000 | cut -c3-
please refine this.
Of course the above command also searches in the sub directories which I dont want.
please dont use 'maxdepth' since it would not work on my unix.
appreciate your help!
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
how can find length of file names in a directory.
Examp:
I have a directory with name "d1".
directory: d1
files:
aaa.log
bbb.log
abcd.log
abcdef.log
I wold like out put like:
file name legnth
aaa.log 3
bbb.log 3
abcd.log 4
abcdef.log 5 (5 Replies)
Discussion started by: koti_rama
5 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have to copy a set of files abc* in /path/ to /path1/ as abc*_bkp.
The list of files appear as follows in /path/:
abc1
xyszd
abc2
re2345
abcx
..
.
abcxyz
I have to copy them (abc* files only) into /path1/ as:
abc1_bkp
abc2_bkp
abcx_bkp
..
. (6 Replies)
Discussion started by: new_learner
6 Replies
3. AIX
Hi,
I am trying to find the content of file using grep and find command and list only the file names
but i am getting entire file list of files in the directory
find . -exec grep "test" {} \; -ls
Can anyone of you correct this (2 Replies)
Discussion started by: madhu_Jagarapu
2 Replies
4. UNIX for Dummies Questions & Answers
Hello,
How to find the list of 5 largest(size wise) file in current directory?i tried using
ls -l | sort -t " " -r +5 -6 -n | head -5
but this is not giving correct output as ls -l command gives 1 extra line of output that is how many total files are there!so by running the above... (4 Replies)
Discussion started by: salman4u
4 Replies
5. Shell Programming and Scripting
I have a script that generates a variable with the location of a file and its complete path. What i want to do is to "cd" to the directory where that file is located using the path name of the file. GIS has absolutely failed me.
For example when i run my script it generates a variable called... (1 Reply)
Discussion started by: Knome
1 Replies
6. Shell Programming and Scripting
I have some files, those are abbreviated (ed,ea, and bi)
company_ed_20100719.txt
company_ea_20100719.txt
company_bi_20100719.txt
I would like to rename these files by replacing
ed with EmployeeDetails
ea with EmployeeAddress
bi with BankInfomration
as
company_... (3 Replies)
Discussion started by: LinuxLearner
3 Replies
7. Programming
How do I print all the file names in current directory in C? (6 Replies)
Discussion started by: omega666
6 Replies
8. Shell Programming and Scripting
hello I'm doing a unix program and i'm using many file csv.in each csv file the colums are separated by ";" I would like to know the position of a pattern. For example for a line yyyy, bbbb, cccc; ddddd;eeee. I will like for example by finding the position of the pattern "cccc" and the response is... (6 Replies)
Discussion started by: papis
6 Replies
9. Shell Programming and Scripting
I need assistance with following requirement, I am new to Unix.
I want to do the following task but stuck with file creation date(sysdate)
Following is the requirement
I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
Discussion started by: PreetArul
4 Replies
find(n) [incr Tcl] find(n)
NAME
find - search for classes and objects
SYNOPSIS
find option ?arg arg ...?
DESCRIPTION
The find command is used to find classes and objects that are available in the current interpreter. Classes and objects are reported first
in the active namespace, then in all other namespaces in the interpreter.
The option argument determines what action is carried out by the command. The legal options (which may be abbreviated) are:
find classes ?pattern?
Returns a list of [incr Tcl] classes. Classes in the current namespace are listed first, followed by classes in all other names-
paces in the interpreter. If the optional pattern is specified, then the reported names are compared using the rules of the "string
match" command, and only matching names are reported.
If a class resides in the current namespace context, this command reports its simple name--without any qualifiers. However, if the
pattern contains :: qualifiers, or if the class resides in another context, this command reports its fully-qualified name. There-
fore, you can use the following command to obtain a list where all names are fully-qualified: find classes ::*
find objects ?pattern? ?-class className? ?-isa className?
Returns a list of [incr Tcl] objects. Objects in the current namespace are listed first, followed by objects in all other names-
paces in the interpreter. If the optional pattern is specified, then the reported names are compared using the rules of the "string
match" command, and only matching names are reported. If the optional "-class" parameter is specified, this list is restricted to
objects whose most-specific class is className. If the optional "-isa" parameter is specified, this list is further restricted to
objects having the given className anywhere in their heritage.
If an object resides in the current namespace context, this command reports its simple name--without any qualifiers. However, if
the pattern contains :: qualifiers, or if the object resides in another context, this command reports its fully-qualified name.
Therefore, you can use the following command to obtain a list where all names are fully-qualified: find objects ::*
KEYWORDS
class, object, search, import
itcl 3.0 find(n)