search and remove command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers search and remove command
# 1  
Old 08-28-2003
search and remove command

I want to run the 'locate' command and then remove what the command finds.

My guess was, locate blahblah |rm -f

but this does not work.

Thanks!
# 2  
Old 08-29-2003
Can you be a bit more specific? What exactly do you want to remove? What is this "locate" command?

The fact that used "rm -f" suggests that you are possibly trying to delete files. I'm not really sure of that, but here is an example of what I suspect may be what you're trying to do:

find $HOME -name core -print | xargs rm
# 3  
Old 09-05-2003
Hey Per...

make sure he knows that $HOME is a variable he sets for the search directory and "core" is a filename you are looking for...

Just trying to keep it clear as mud hehe....
# 4  
Old 09-05-2003
Actually $HOME is the user's home directory and is set automatically by the login program.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to search for pattern and remove line

I am an awk beginner and need help figuring out how to search for a number in the first column and if it (or anything greater) exists, remove those lines. AM11400012012 2.26 2.12 1.98 2.52 3.53 3.01 3.62 5.00 3.65 7.95 0.79 3.88 0.00 AM11400012013 3.39 2.29 ... (1 Reply)
Discussion started by: ncwxpanther
1 Replies

2. Shell Programming and Scripting

How to search multiple patterns and remove lines from a file?

Hi, I have a file content as below. Table : PAYR Displayed fields: 15 of 15 Fixed columns: 4 List width 0999... (4 Replies)
Discussion started by: shirdi
4 Replies

3. Shell Programming and Scripting

Search and remove the lines

Hallo Team, Hope you are having a wonderful Friday. Here goes i am searching for a pattern and after finding the lines which contain this pattern i want to remove/delete them. This is my code: grep Originating BW*2013*|grep -v "ACCOUNT NOT FOUND"|grep -v "Unknown called number"|grep -v... (2 Replies)
Discussion started by: kekanap
2 Replies

4. UNIX for Dummies Questions & Answers

Search and remove in .txt

hi all I know this is a very simple question but any help would be much appreciated. with other threads not so far having come up with a solution. I have many long .txt files which have column which looks something like this: head test.txt -3.3 2.3 -11.1 .... 1.2 .... -3.1 .... All... (4 Replies)
Discussion started by: expostfacto
4 Replies

5. Shell Programming and Scripting

Search based on 1,2,4,5 columns and remove duplicates in the same file.

Hi, I am unable to search the duplicates in a file based on the 1st,2nd,4th,5th columns in a file and also remove the duplicates in the same file. Source filename: Filename.csv "1","ccc","information","5000","temp","concept","new" "1","ddd","information","6000","temp","concept","new"... (2 Replies)
Discussion started by: onesuri
2 Replies

6. Shell Programming and Scripting

Search and Remove No data Section

Hello, I have written a script that removes duplicates within a file and places them in another report. File: ABC1 012345 header ABC2 7890-000 ABC3 012345 Content Header ABC5 593.0000 587.4800 ABC5 593.5000 587.6580 ABC5 593.5000 587.6580 ABC1 67890 header ABC2 1234-0001 ABC3... (2 Replies)
Discussion started by: petersf
2 Replies

7. Shell Programming and Scripting

Search and Remove Lines within File

Hello, I've searched through the scripting section but could not find what I need. I need to search for empty sections within a file and remove them. Here is an example file: Title 123 A B C D E Title 098 Title 567 Z Y (4 Replies)
Discussion started by: leepet01
4 Replies

8. Shell Programming and Scripting

Search and remove in a text file

Need help whit a script where I have to input a name and then remove a line where that name is in a file file ex: 001op;Name;Location;date 002op;Name;Location;date and so on.... can anybody help me??? thanks (4 Replies)
Discussion started by: nogame11
4 Replies

9. Shell Programming and Scripting

How to search then remove based on condition

Folks; I'm trying to write a script to scan through a directory tree then for each file it finds, it run a command line tool, then if the results include the word "DONE", it removes the file. In more details; i have a Linux directory tree such as "/opt/grid/1022/store" I'm trying to write a... (6 Replies)
Discussion started by: Katkota
6 Replies

10. Shell Programming and Scripting

different take on common ?: search for two strings and remove lines between them

Thank you for assisting, I've got a partial solution just needs a tweak. Hulk-BASH$ cat somefile.txt oh there is some stuff here some more stuff here START_LABEL stuff I want more stuff I want END_LABEL other stuff here too and even more stuff here too Hulk-BASH$ Hulk-BASH$ sed... (8 Replies)
Discussion started by: laser
8 Replies
Login or Register to Ask a Question