Sponsored Content
Full Discussion: find usage with parameters
Top Forums UNIX for Dummies Questions & Answers find usage with parameters Post 302339892 by wtolentino on Friday 31st of July 2009 04:27:02 PM
Old 07-31-2009
thank you and it works. i used the first example you posted and i was able to get the expected results.

Code:
pfile=$1
pday=$2

vdir=`pwd`
vctr=0
echo current directory $vdir

for i in `find $vdir -name "$pfile" -mtime +$pday`
do
  let vctr=$vctr+1
  vfile=`basename $i`
  echo aging files $vfile
done

if [ $vctr -eq 0 ]; then
  echo "no aging files found that are $pday days old"
fi

# put a white space
echo

Code:
$ sh rm_aging_file.sh "lpa_load_oscm161*.dat" 360
current directory /export/home/lpaftdv/data/archive
no aging files found that are 360 days old

$ sh rm_aging_file.sh "lpa_load_oscm161*.dat" 180
current directory /export/home/lpaftdv/data/archive
aging files lpa_load_oscm161_2008085.dat
aging files lpa_load_oscm161_20080812.dat
aging files lpa_load_oscm161_20080819.dat
aging files lpa_load_oscm161_20080826.dat
aging files lpa_load_oscm161_2008092.dat
aging files lpa_load_oscm161_2008099.dat
aging files lpa_load_oscm161_20080916.dat
aging files lpa_load_oscm161_20080923.dat
aging files lpa_load_oscm161_20080930.dat
aging files lpa_load_oscm161_2008107.dat
aging files lpa_load_oscm161_20081014.dat
aging files lpa_load_oscm161_20081021.dat
aging files lpa_load_oscm161_20081028.dat
aging files lpa_load_oscm161_2008114.dat
aging files lpa_load_oscm161_20081111.dat
aging files lpa_load_oscm161_20081118.dat
aging files lpa_load_oscm161_20081125.dat
aging files lpa_load_oscm161_2008122.dat
aging files lpa_load_oscm161_2008129.dat
aging files lpa_load_oscm161_20081216.dat
aging files lpa_load_oscm161_20081223.dat
aging files lpa_load_oscm161_20081230.dat
aging files lpa_load_oscm161_2009016.dat
aging files lpa_load_oscm161_20090113.dat
aging files lpa_load_oscm161_20090120.dat
aging files lpa_load_oscm161_20090127.dat

$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is it possible to find parameters?

I have a shell script and i pass 3 parameters to it. Just give you an example test.sh a=y/n b=y/n c=y/n Pass y/n to a, b and c then it will decide what to do. test.sh a=y b=n c=n What i would like to do is rather then passing 3 parameter just pass a=y (only a is doing something like... (2 Replies)
Discussion started by: J_ang
2 Replies

2. UNIX for Advanced & Expert Users

How to Find AIX system parameters

System Parameters: maximum number of processes = 2048 Network parameters: ipqmaxlen - 512 rfc1323 - 1 sb_max - 1310720 (2*655360) tcp_recvspace - 65536 tcp_sendspace - 65536 Udp_recvspace - 655360 Udp_sendspace 65536 (1 Reply)
Discussion started by: R00tSc0rpi0n
1 Replies

3. Shell Programming and Scripting

using a vaiable parameters and values to find and tar

This one took HOURS and HOURS of my life. Hopefully this post will save someone the same grief. I am using "-regex" with "find" via a variable. If I echo the command that is constructed, it looks OK. When I paste the echoed text it to the command line it runs fine. But inside the script it... (1 Reply)
Discussion started by: jjminkle
1 Replies

4. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

5. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

6. Shell Programming and Scripting

Find Usage solved

How can I find the biggest file in a branch? I tried find / \*.\* | xargs du | sort -n 1,1 | head 1 but shell do nothings :( ---------- Post updated at 03:07 PM ---------- Previous update was at 02:41 PM ---------- Solved: find / -name \*.\* | xargs du | sort -nr | head -n 1 (0 Replies)
Discussion started by: Guccio
0 Replies

7. Shell Programming and Scripting

Passing wildcard parameters to find via a variable

I have a script to fix permissions which is made up of blocks like: FS_ROOT=/home/shared/Photos FS_EXCLUDE=( \( -path */.webviews -o -path */.thumbnails \) -prune -o ) find $FS_ROOT ${FS_EXCLUDE} -type d -not -perm 2770 -exec chmod 2770 "{}" \; That fragment works as expected, but no matter... (3 Replies)
Discussion started by: mij
3 Replies

8. UNIX for Dummies Questions & Answers

Usage of find command

I need to find a file that has been modified in last 3-4 hours. mtime tells us about file modified in n days. Is there any way I can check for hours or minutes file modified or created before. (5 Replies)
Discussion started by: ankush_mehra
5 Replies

9. Solaris

Usage of -prune and -name in find

I am into cd /home/work/amey/history-*/ Under amey I have directories history, history-1, history-2 and under history-2 I have got 2 files 3 and 2. When I run the find command I get the below o/p. find /home/work/amey/history-*/. -name . -o -prune -type f /home/work/amey/history-1/.... (1 Reply)
Discussion started by: ameyrk
1 Replies

10. Shell Programming and Scripting

Find the year and assign to different parameters

Hi All, I have a unix directory and under which the below set of files(Years will change) will be there ##################################### TEST_DETAIL_HCR_ABC2015_T01152015.csv TEST_DETAIL_HCR_ABC2014_T01152015.csv TEST_DETAIL_HCA_ABC2013_T01152015.csv I need to assign years to... (2 Replies)
Discussion started by: weknowd
2 Replies
pymcaroitool(1) 					 PyMca X-Ray Fluorescence Toolkit					   pymcaroitool(1)

NAME
pymcaroitool - PyMca region-of-interest imaging X application SYNOPSIS
pymcaroitool [OPTIONS]... [FILE(S)] DESCRIPTION
Start the graphical user interface of the PyMca X-Ray Fluorescence Toolkit region-of-interest imaging tool. This tool is best suited for handling datasets that can be represented by three-dimensional arrays. Typical cases are stacks of images (first dimension is image number) or 2D maps of 1D spectra (last dimension is spectrum channel number). It allows to display maps of particular regions of the spectra or spectra of a particular region of the map. A system of plugins allow to extend the capabilities of this tool. Plugins for multivariate analysis are already built in. If FILE is given, it will be opened in the program provided its format is supported. EXAMPLES
pymcaroitool Start the program with a file browser to select the input files. pymcaroitool file_0001.edf Tries to open the file named file_0001.edf and all indexed files of the form file_????.edf where ???? is a number. pymcaroitool --imagestack=1 file_0001.edf Tries to open the file named file_0001.edf and all indexed files of the form file_????.edf where ???? is a number as a set of images. pymcaroitool uncompressed_tiff_file_0001.tif Tries to open a series of uncompressed TIFF files as an image stack. pymcaroitool --begin=100 --end=200 --filepattern=file_%05d.edf Start the program loading the single indexed files from file_00100.edf to file_00200.edf pymcaroitool --begin=10,100 --end=20,200 --filepattern=row%d_col%03d.dat Load the double indexed files from row10_col100.dat, row10_col101.dat, ... to row20_col00199.dat, row20_col00200.dat CAVEATS
If files f_000.xxx and f_001.xxx are present in the same directory, the program will always try to load both of them unless a cumbersome way using a file pattern is used. SEE ALSO
HDF5, h5py ESRF
March 2012 pymcaroitool(1)
All times are GMT -4. The time now is 07:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy