batch delete using find, files with # character


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers batch delete using find, files with # character
# 1  
Old 05-30-2006
batch delete using find, files with # character

UPDATE: Sorry, disregard this.

It did work, I made a mistake; I just shouldn't have been using maxdepth.

I do think it is good to know, however, that

find | grep '#' | xargs rm

will "clean up" funnily named files in a directory. Of course, some of those funnily named files are there for a reason so use with care...

************************

I want to delete files containing #.

find -maxdepth 1 | grep '#'

gives me the files I want to delete, but when I try piping this into xargs with

find -maxdepth 1 | grep '#' | xargs rm

I get

rm: missing operand.

Is there some way I can get batched delete of files with special chars?

Thanks!

Last edited by tphyahoo; 05-30-2006 at 01:11 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Delete Directories and its files that begin with the same character string

I wrote a shell script program that supposed to delete any directories and its files that begin with the same character string . The program is designed to delete directories and its files that are one day old or less and only the directories that begin with the same character string. The problem... (1 Reply)
Discussion started by: dellanicholson
1 Replies

2. UNIX for Dummies Questions & Answers

Find command to delete old files

Hi, I want to delete all the log files that was created on year 2008. My command is not working. Any idea? find . -name '*.log' -mtime 1460 -exec ls -lt {} \; Thank you. (2 Replies)
Discussion started by: samnyc
2 Replies

3. UNIX for Dummies Questions & Answers

Script to find the files and delete them

This is a real world problem so I think you might found this interesting. We have servers which are shared by multiple team members. Each team member has its own user id and home directory. Now with time each user starts creating files which in end caused the disk to be full. Now for creating a... (5 Replies)
Discussion started by: Rohit06
5 Replies

4. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

5. Shell Programming and Scripting

find files for a particular date and delete

How can I delete files for a particular date ? I apologize in advance If there is solution please put the link. Thanks, (5 Replies)
Discussion started by: jville
5 Replies

6. UNIX for Dummies Questions & Answers

find and delete files

hi all , i want to find and interactively delete all the files having size greater than 20 bytes using "find" and other commands..... (8 Replies)
Discussion started by: sonu_pal
8 Replies

7. Shell Programming and Scripting

A Batch job to delete files from various directories

Hi, I have a shell script to find files older than 'X' days ($2) in directory path ($1) and delete them. Like this: my_file_remover.sh /usr/home/c 90 Now, I need to modify this script and add it in CRON, so that it checks other directories also. Like: my_file_remover.sh /usr/home/c... (3 Replies)
Discussion started by: guruparan18
3 Replies

8. Shell Programming and Scripting

need to find last character in each line in all files

Hi, I need to read each line in all files .If last character in each line is not ;(semicolon) then i need to append next line also.Here each line may consists of multiple semicolons(;).but i need to read only last character.I need to achieve this using shell script.And i need to remove tht last... (7 Replies)
Discussion started by: dbsurf
7 Replies

9. UNIX for Dummies Questions & Answers

Find files which contain a null character

Hi, I would like to use grep to find files which contain NULL characters. I'm not sure how to represent the null character in the grep statement. Could anyone help please? Thanks! Helen :confused: (5 Replies)
Discussion started by: Bab00shka
5 Replies

10. Windows & DOS: Issues & Discussions

Schedule a Batch file to delete files at particular intervals

Hi, I need to write a batch file/shell script that runs at specified intervals daily and deletes specified set of files. Can anyone pls help me with the code. Thanks, Indom. (6 Replies)
Discussion started by: Indom
6 Replies
Login or Register to Ask a Question
lookbib(1)							   User Commands							lookbib(1)

NAME
lookbib - find references in a bibliographic database SYNOPSIS
lookbib database DESCRIPTION
A bibliographic reference is a set of lines, constituting fields of bibliographic information. Each field starts on a line beginning with a `%', followed by a key-letter, then a blank, and finally the contents of the field, which may continue until the next line starting with `%'. The lookbib utility uses an inverted index made by indxbib to find sets of bibliographic references. It reads keywords typed after the `>' prompt on the terminal, and retrieves records containing all these keywords. If nothing matches, nothing is returned except another `>' prompt. It is possible to search multiple databases, as long as they have a common index made by indxbib(1). In that case, only the first argument given to indxbib is specified to lookbib. If lookbib does not find the index files (the .i[abc] files), it looks for a reference file with the same name as the argument, without the suffixes. It creates a file with a .ig suffix, suitable for use with fgrep (see grep(1)). lookbib then uses this fgrep file to find refer- ences. This method is simpler to use, but the .ig file is slower to use than the .i[abc] files, and does not allow the use of multiple reference files. FILES
x.ia x.ib x.ic index files x.ig reference file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWdoc | +-----------------------------+-----------------------------+ SEE ALSO
addbib(1), grep(1), indxbib(1), refer(1), roffbib(1), sortbib(1), attributes(5) BUGS
Probably all dates should be indexed, since many disciplines refer to literature written in the 1800s or earlier. SunOS 5.10 14 Sep 1992 lookbib(1)