Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using find command with variables Post 302930695 by RavinderSingh13 on Tuesday 6th of January 2015 01:07:53 PM
Old 01-06-2015
Hello newbie2010,

Following may help you in same, I tested in bash.
1st please check the file names which you want to delete, if satisfied with result use 2nd command.
Code:
VAR="PET-DOG"
find -type f -name "*$VAR*"
./TEST-PET-DOG-234
./TEST-PET-DOG-TEST

I got above results as I have created some test files to check it.

2nd command:
Code:
find -type f -name "*$VAR*" -exec rm -rf {} \;

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Little bit weired : Find files in UNIX w/o using find or where command

Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same. Thanks in advance. Regards Jatin Jain (10 Replies)
Discussion started by: jatin.jain
10 Replies

3. Shell Programming and Scripting

assign a command line argument and a unix command to awk variables

Hi , I have a piece of code ...wherein I need to assign the following ... 1) A command line argument to a variable e.g origCount=ARGV 2) A unix command to a variable e.g result=`wc -l testFile.txt` in my awk shell script When I do this : print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies

4. Linux

Simplified find command to find multiple file types

Hi, I'm using the following command to find the multiple requierd file types and its working fine find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies

5. UNIX for Dummies Questions & Answers

How do I find the correct environment variables for MPI?

Hello all. I've been trying to install NWCHEM in parallel on a new cluster, and have been able to get it to work on single processors by ignoring any MPI environment variables. This is, of course, pretty worthless. So I'm starting over and trying to get thing set up right for the MPI. The key... (6 Replies)
Discussion started by: EinsteinMcfly
6 Replies

6. Shell Programming and Scripting

Find global variables, c source

Hello.I have been trying to solve the following problem, but to no avail. If anyone could please give me some indications, or anything, it would be amazing. A C source program and a type name are given. Determine from source, the list of the global variables having the given type. For each... (5 Replies)
Discussion started by: Susan78
5 Replies

7. Shell Programming and Scripting

Find and replace variables using a csv table

I have a flat file (template) where I want to replace variables based upon a value in another file (csv). The variables in the template are named %VAR_X_z% The values are in the csv file and X is field 0 of each line and y field 1 and up. Example of the csv: Badidas, 13.00, 12.00, 11.00,... (8 Replies)
Discussion started by: biscayne
8 Replies

8. Shell Programming and Scripting

Using a find command in ssh but using local variables?

I have a script like this (Yes, I know the DAY6 number isn't right - I'm just testing at this point): DAY0=`date -I` DAY1=`date -I -d "1 day ago"` DAY6=`date -I -d "2 days ago"` if then ssh root@synology1 nohup rm -rf "/volume1/Fileserver/$DAY6" fi I've tested the line to remove the... (5 Replies)
Discussion started by: Orionizer
5 Replies

9. Shell Programming and Scripting

Find between lines start and end: awk with bash variables

I have a file as follows: 0 1056 85540 414329 774485 1208487 1657519 2102753 2561259 3037737 3458144 3993019 4417959 4809964 5261890 5798778 6254146 I want to find all lines between a specified start and end tag. (6 Replies)
Discussion started by: jamie_123
6 Replies

10. UNIX for Advanced & Expert Users

AIX find with Variables

I am trying to do a find with a variable but no matter which way I try it does not work. This is aix. Can I get some ideas on what I am doing wrong? for i in `cat file`; do find / -type f -name "$i" -exec ls -l {} + ; done for i in `cat file`; do find / -type f -name "\$i" -exec ls -l... (6 Replies)
Discussion started by: cokedude
6 Replies
VICE(1) 						      General Commands Manual							   VICE(1)

NAME
VICE - Versatile Commodore Emulator and Virtual Commodore Environment DESCRIPTION
VICE is a multi-platform emulator of the Commodore PET, CBM-II (C610), VIC20, C64, C64DTV, C128 and Plus4 8-bit computers. The emulators run as separate programs, but have the same user interface, share the same settings and support the same file formats. Also some external utilities are provided. VICE is made up of the following programs: x64 a fast Commodore 64 emulator for the X Window System x64sc an accurate Commodore 64 emulator for the X Window System x64dtv a C64DTV emulator for the X Window System x128 a Commodore 128 emulator for the X Window System xvic a Commodore VIC20 emulator for the X Window System xpet a Commodore PET emulator for the X Window System xplus4 a Commodore Plus4 emulator for the X Window System xcbm2 a Commodore CBM-II (C610) emulator for the X Window System c1541 a stand-alone disk image maintenance utility; petcat a Commodore BASIC de-tokenizer; The whole documentation for these programs is available in HTML format; the main file should be installed on your system as /usr/share/doc/vice/html/vice_toc.html . For up to date news about VICE, have a look at the official home page at http://vice-emu.sourceforge.net/ SEE ALSO
petcat(1), c1541(1) AUTHORS
Andreas Boose <boose@linux.rz.fh-hannover.de> Dag Lem <resid@nimrod.no> Tibor Biczo <crown@mail.matav.hu> Andreas Dehmel <zarquon@t-online.de> Thomas Bretz <tbretz@ph.tum.de> Andreas Matthies <andreas.matthies@gmx.net> Martin Pottendorfer <Martin.Pottendorfer@aut.alcatel.at> Markus Brenner <markus@brenner.de> Spiro Trikaliotis <Spiro.Trikaliotis@gmx.de> Marco van den Heuvel <blackystardust68@yahoo.com> David Hansel <david@hansels.net> Daniel Sladic <sladic@eecg.toronto.edu> Ettore Perazzoli Teemu Rantanen <tvr@cs.hut.fi> Andre' Fachat <fachat@physik.tu-chemnitz.de> Jouko Valta <jopi@stekt.oulu.fi> Jarkko Sonninen <sonninen@lut.fi> with several contributions from other people around the world; see the HTML documentation for more information. VICE
Feb 2004 VICE(1)
All times are GMT -4. The time now is 09:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy