find only 6 char long


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find only 6 char long
# 15  
Old 10-11-2012
Quote:
Originally Posted by pamu
try with this....


Code:
find /tmp -type f -mtime +180 | grep '/tmp/......$'

Still nothing returns. I am on AIX 6.1
# 16  
Old 10-11-2012
try with this...

Code:
find /tmp -type f -mtime +180 | awk  'length($0) == 11'

Here many ways of doing this are described in this thread but any of these are not solving your purpose...Smilie
# 17  
Old 10-11-2012
Quote:
Originally Posted by pamu
try with this....
Code:
find /tmp -type f -mtime +180 | grep '/tmp/......$'

Since that find command is allowed to descend into subdirectories, there exists the possiblity that another directory named "tmp" could be visited. Because of this, your grep regular expression is underspecified. You must anchor it at the beginning as well.


Quote:
Originally Posted by Daniel Gate
If I just run
PHP Code:
find /tmp -type f -mtime +180 
, I am getting these outputs.
HTML Code:
....
/tmp/yZqcMa
/tmp/yZyiya
/tmp/y_Mdia
/tmp/y_Qcia
/tmp/y_Qcya
/tmp/y_ap7a
/tmp/y_mkia
/tmp/y_qfUa
/tmp/y_yc7a
/tmp/ypMe7a
/tmp/ypYk7a
/tmp/yxAi7a
....
Based on that output, I don't see how pamu's suggestion could not have returned something.
Quote:
Originally Posted by Daniel Gate
Still nothing returns.
Could there be whitespace after the filenames? If not, you must have made some mistake in typing the command. Perhaps a dot too many/few?

Here's yet another suggestion, a find approach that restricts itself to AIX 6.1 primaries:
Code:
find /tmp -type f -mtime +180 -name '??????' -print -o -type d -exec test {} \!= /tmp \; -prune

Regards,
Alister

Last edited by alister; 10-11-2012 at 02:48 PM.. Reason: removed complicating optimization
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find command take too long

Hi, I use the below script that will find n record the entire directory structure for a given folder. bash-3.2$ more mkdir.sh find . -type d |while read rec do echo "mkdir $rec" echo "chmod -R 777 $rec" #done done >> moht.sh The problem is the folder i m running this script... (10 Replies)
Discussion started by: mohtashims
10 Replies

2. Shell Programming and Scripting

To find char field and replace null

hi, i having a file with | seperated in which i need to search char in 3rd column and replace with null. i need to replace only the coulmn where character occurs in 3rd field for eg: file1.txt xx|yy|xx|12 output file: xx|yy||12 (5 Replies)
Discussion started by: rohit_shinez
5 Replies

3. Shell Programming and Scripting

Find and replace all extended char.

Hi Guys, I wand find and replace all Extended ASCII Codes from all my log files. My Log files: /home/Kalr/PPool/Output i have logs file in sub dir. /home/Kalr/PPool/Output/X /home/Kalr/PPool/Output/Y /home/Kalr/PPool/Output/Z My Abc.log file input: Extended ASCII Codes :– ... (4 Replies)
Discussion started by: asavaliya
4 Replies

4. Shell Programming and Scripting

cutting long text by special char around 100 byte and newline

Regard, How can i cut the text by special char(|) around 100 byte and write the other of the text at newline using Perl. ... (3 Replies)
Discussion started by: Shawn, Lee
3 Replies

5. Programming

Help with understanding ( int, char, long, short, signed, unsigned etc.... )

My question is simple: When should I use a long, int, char, unsigned/signed variables?? When I declare a variable "unsigned;" what did I do it??? Why would I delcare an integer "long" or "short" ( unsigned or signed)?? Any examples of when things like "unsigned", "long", "short" etc...... (6 Replies)
Discussion started by: cpp_beginner
6 Replies

6. Programming

How to find length of string and pass into char array in C?

Hi All I want to take a Hexadecimal number as input and i want to find lenth of the input and pass it to char s ( char s ). I have a program to convert hexadecial to binary but it is taking limited input but i want to return binary number based on input. How? (1 Reply)
Discussion started by: atharalikhan
1 Replies

7. Shell Programming and Scripting

Line gets splitted into 99 char long pieces

Hello, I have a script like follows. It reads a file, and with every line, it calls an "adapter" program, which just puts the line into MQ. When I run this locally, it works fine. When I run this on our company's server, one line is split into several pieces (99 characters long) and "adapter"... (1 Reply)
Discussion started by: Adamm
1 Replies

8. Shell Programming and Scripting

To find number of char occur

To find out number of "|" symbol is available in file: Input: a|b|c|d|z Ouput: 4 I am using below set of commands,It is working... Anybody have anyother solution using sed / awk. cnt=`wc -c <1.txt` cnt1=`tr -d "|" <1.txt >c.dat` cnt2=`wc -c <c.dat` outp=`expr $cnt... (19 Replies)
Discussion started by: Jairaj
19 Replies

9. Shell Programming and Scripting

grep : search a long char contain space

Hi, i have to search for a char like that : export var1="i am not happy /not happy" with a command like : grep $var1 file but this not working with me !!! thank you in advance. (2 Replies)
Discussion started by: tizilfin
2 Replies

10. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies
Login or Register to Ask a Question