Piping a find to cvs admin - please critique


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Piping a find to cvs admin - please critique
# 1  
Old 01-30-2007
Piping a find to cvs admin - please critique

My task is to go through a CVS repository and flag binary files of a set exentsion. For the purposes of this question, please assume the file types to be flagged are JPG, PDF, and BMP.

I check out the module and run the following command:

cvs admin -kb < find ./checkoutDIR -name *.jpg -o -name *.bmp -o -name *.pdf

I think this is doing what I want it to do. Correct?
# 2  
Old 01-30-2007
It was pointed out to me that the exec flag in find is much safer

/usr/local/bin/find /tmp/webUser \( -name "*.java" -o -name "*.cfm" \) -exec cvs admin -kb {} \;

This is working fine with no detected problems. It was my first time using the parens for multiple files. Find is apparently very, very unforgiving with spacing.
# 3  
Old 01-30-2007
Quote:
Originally Posted by Dbecker
It was pointed out to me that the exec flag in find is much safer

/usr/local/bin/find /tmp/webUser \( -name "*.java" -o -name "*.cfm" \) -exec cvs admin -kb {} \;

This is working fine with no detected problems. It was my first time using the parens for multiple files. Find is apparently very, very unforgiving with spacing.

If you use wildcards in a find, either use double quotes around them (as you did above) or escape them.

so, as above
\( -name "*.java" -o -name "*.cfm" \)
is fine

\( -name \*.java -o -name \*.cfm \)
is fine as well

\( -name *.java -o -name *.cfm \)
is not fine, because the wildcards will be interpreted by the shell, where you want them to be interpreted by the find command.

In your initial example you used wildcards with escaping them or putting them within double quotes.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

Regarding Admin life either as DBA or UNIX Linux admin

I am planning to choose my career as Unix/Linux Admin or a DBA. But I have come to know from forums and few admins like the job will be 24/7. I have few questions on that. Can we get "DAY" shifts in any one of the admin Job ? Can't we have shift timings in any company ? Eventhough the... (7 Replies)
Discussion started by: Jacktts
7 Replies

2. UNIX for Advanced & Expert Users

Problem piping find output to awk, 1st line filename is truncated, other lines are fine.

Today I needed to take a look through a load of large backup files, so I wrote the following line to find them, order them by size, and print the file sizes in GB along with the filename. What happened was odd, the output was all as expected except for the first output line which had the filename... (4 Replies)
Discussion started by: gencon
4 Replies

3. Shell Programming and Scripting

Find and move files parsed from cvs file

I need help with a bash script. We have a directory of files which need to be renamed and moved to another directory based on filename information in a cvs file. The contents of the cvs file are as follows: A102345,abc123 A102347,dfg475 Where dfg475 is the basename without extension Our... (8 Replies)
Discussion started by: Lloyd Boyette
8 Replies

4. What is on Your Mind?

Windows Admin switching to *nix Admin

I'm currently a Windows admin and have wanted to jump ship to the *nix side for a while now. I've been studying both through an lpic level 1 manual as I have time (focusing on debian), and a solaris 10 cert book. The problem is I only have a handful of hours a week to study, and my current job... (3 Replies)
Discussion started by: bobwilson
3 Replies

5. Solaris

Piping results of 'ls' to 'find' using 'xargs'

I'm trying to get a count of all the files in a series of directories on a per directory basis. Directory structure is like (but with many more files): /dir1/subdir1/file1.txt /dir1/subdir1/file2.txt /dir1/subdir2/file1.txt /dir1/subdir2/file2.txt /dir2/subdir1/file1.txt... (4 Replies)
Discussion started by: MartynAbbott
4 Replies

6. UNIX for Dummies Questions & Answers

use of xargs and prune piping with find command.

Can anyone interpret and tell me the way the below command works? find * -name "*${msgType}" -mtime +${archiveDays} -prune -type f -print 2>/dev/null | xargs rm -f 2> /dev/null Please tell me the usage of prune and xargs in the above command? Looking forward your reply. Thanks in... (1 Reply)
Discussion started by: venkatesht
1 Replies

7. Debian

What is CVS...?

Hi everyone... Could one of you kind Linux experts please let me know what CVS is In return I will kindly give you a thumbs up :b: a good trade I feel!! (1 Reply)
Discussion started by: TonyChapman
1 Replies

8. UNIX for Dummies Questions & Answers

piping the output of find command to grep

Hi, I did not understand why the following did not work out as I expected: find . -name "pqp.txt" | grep -v "Permission" I thought I would be able to catch whichever paths containing my pqp.txt file without receiving the display of messages such as "find: cannot access... Permisson... (1 Reply)
Discussion started by: 435 Gavea
1 Replies
Login or Register to Ask a Question