Need some help writing a find script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need some help writing a find script
# 8  
Old 03-17-2012
This should work on smaller structures with gnu find Smilie ( just for the sake of it Smilie )
Code:
DIR=$1
cd $DIR
EXCLD=$(find . -type d ! -perm -o=x -printf "%p/.*|")
#if [[ $(echo $EXCLD | wc -c) -lt $(getconf ARG_MAX) ]]; then
        find . -type f -regextype posix-egrep ! -regex "$EXCLD" # if the parent doesnt have x on last bit we exclude whole structure behind it
#else
#        echo "We have passed system limit $(getconf ARG_MAX)"
#fi

This User Gave Thanks to Peasant For This Post:
# 9  
Old 03-17-2012
with some coding i get almost the perfect solution, thanks mate Smilie

i have only one more question, how could i cut every rows tail

cause the stdout will looks like this:
Code:
./directory/file.ext
./file.ext

instead of this:
Code:
directory/file.ext
file.ext

i tried with TAIL -c +3, but that command will only cut the first rows characters instead of every row
# 10  
Old 03-17-2012
Like this?
Code:
tail infile | cut -c3-

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I need help writing this script

:wall: Can't seem to figure out how to fix this please help its not starting over like I would like it to When I enter in "Date" or "Time" nothing comes Also if you can tell me the commands for the other 3 stuff that would be much appreciated #!/bin/bash clear while ; do echo... (8 Replies)
Discussion started by: nowruzr
8 Replies

2. Shell Programming and Scripting

how to find a job which is writing a big file and eating up space?

how to find a job which is writing a big file and eating up space? (3 Replies)
Discussion started by: rush2andy
3 Replies

3. Shell Programming and Scripting

Help in writing a find/replace script using awk

Hi All, I need to write a script that will go through 600+ files and perform find and replace. I was going to use sed but there is a level of complexity that is doing my head in. To explain: I have 600+ files that have a line in them that reads (for example) FILE=DCLCLHST... (4 Replies)
Discussion started by: Kocko
4 Replies

4. Shell Programming and Scripting

writing shell script to find line of invalid characters

Hi, I have to write s script to check an input file for invalid characters. In this script I have to find the exact line of the invalid character. If the input file contain 2 invalid character sat line 10 and 17, the script will show the value 10 and 17. Any help is appreciated. (3 Replies)
Discussion started by: beginner82
3 Replies

5. UNIX for Dummies Questions & Answers

Help writing a script to find a file

I just started learning about Unix and I cant figure out what im doing wrong. I'm trying to write a script that will ask for the file name and tell what type it is. This is what i have so far. http://i63.photobucket.com/albums/h123/wacand/untitled.jpg (2 Replies)
Discussion started by: wacand
2 Replies

6. Shell Programming and Scripting

Help me in writing the script

Hi, I have written a script which converts a give hexdecimal value to binary value in perl. But now, the problem is I should read every bit of it ( if its 10101010, i should read the value in each position and if the value in that position is 1 i should print a string and should exit if its... (1 Reply)
Discussion started by: prakashreddy
1 Replies

7. UNIX for Dummies Questions & Answers

Need help writing this script

Here is the script I am trying to write along with my answer I wrote. Please help me understand why it doesn't work. Create an executable script file called "newname" that will perform the followings: 1. Rename a file upon the user's request. If the file exists, prompt the user for... (1 Reply)
Discussion started by: wiggles
1 Replies

8. UNIX for Dummies Questions & Answers

how to find out the systen and n/w charecteristics by writing codes in c

a project is given to me in which i have to find out the system and n/w charecteristics by writing codes in c but i cant use the commands. n/w charecteristics means: Network Adapter Related Information: a. Number of network adapters b. Type of the Adapter: LAN (Ethernet, Token Ring, FDDI),... (8 Replies)
Discussion started by: jeenat
8 Replies

9. UNIX for Dummies Questions & Answers

help for writing a script

Hi, I need help writing a unix script to change the time in the server automatically when it reaches a specified time. Only on the 14th of april, when the time becomes midnight (00:00:00), I need the server to change the time automatically to 23:30:00 and start working on as usual with a... (2 Replies)
Discussion started by: amodha
2 Replies

10. Shell Programming and Scripting

need help writing a script

Hello everyone. Well, I will get right to the point. I am new to Perl and trying to learn it as much as I can. I have been assigned the task of writing a perl script to extract information from firewall logs. Like I said, I am new to Perl and I am having a tough time because I think what I am... (3 Replies)
Discussion started by: tarballed
3 Replies
Login or Register to Ask a Question