10-23-2006
#!/bin/sh
start=1
while read name
do
ls -1 /appl/CH_DATA/archive/00000/CACHE/${name}*.archived | grep -v _9_4_bfmh.archived | grep -v _orig.archived >>output.txt
done <list.txt
for file_number in `cat list10.txt | grep -v _9_4_bfmh.archived | grep -v _orig.archived | sort | cut -c 43,44,45,46,47`
do
if [ $start -eq 1 ] ; then
# this is the first pass of the loop, so we've got nothing to compare
start=0
previous=$file_number
else
# this is not the first pass of the loop
previous=`expr $previous + 1`
#echo "comparing $file_number and $previous ... "
if [ $file_number = $previous ] ; then
echo "ok"
else
seqno=`expr $file_number - 1`
echo "CDBACKUP${name}$seqno are not in sequence "
fi
fi
previous=$file_number
done
#The above is my full script, the list.txt is like:
JOHN1
MARRY
PETER
CATT1
The full filename in CACHE directory is like:
CDBACKUPJOHN100001.archived
CDBACKUPJOHN100002.archived
CDBACKUPJOHN100004.archived
CDBACKUPMARRY00381.archived
CDBACKUPMARRY00382.archived
CDBACKUPMARRY00383.archived
CDBACKUPPETER01101.archived
CDBACKUPPETER01102.archived
CDBACKUPPETER01105.archived
I need to check the jump seq and show the full name which file is missing like:
CDBACKUPJOHN00003 is missing
CDBACKUPMARRY is no missing
CDBACKUPPETER01103 is missing
CDBACKUPPETER01104 is missing
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how can i read a part of filename from the list in the script?
all file in directory...will start with "CDBACKUPFILE" then the name is stored in list.txt such as JOHN,MARRY,PETER. After this, is seq number.
CDBACKUPFILEJOHN00001
CDBACKUPFILEMARRY00004
CDBACKUPFILEPETER00003
I will use:... (3 Replies)
Discussion started by: happyv
3 Replies
2. Shell Programming and Scripting
How would I write a command(s) to read from a file (list) that looks like this: 29847374384 and grep from a second file (list) that looks like this: 29847374384, jkdfkjdf,3833,ddd:confused: (1 Reply)
Discussion started by: smellylizzard
1 Replies
3. Shell Programming and Scripting
Hi, suppose I have a colon delimeterd file with address field like this
blue:john's hospital new haven CT 92881-2322
yellow:La times copr red road los angeles CA90381 1302
red:las vegas hotel sand drive Las vegas NV,21221
How do I create a new field that contain the zip code information... (3 Replies)
Discussion started by: grossgermany
3 Replies
4. Programming
hi
I need a little help writing this small perl script. I'm trying to extract the values from each line in a file and find the average for example
cat school
Highschool 100, 123, 135
Middleschool 41, 67, 54
Elementary 76, 315, 384
./average.pl
highschool: 119.3
middleschool: 54... (2 Replies)
Discussion started by: gengar
2 Replies
5. Shell Programming and Scripting
Hi Experts,
I am writing a shell script (for displaying disk space details) which is logging to 15 different servers using following command.
ssh userid@servername
It is prompting me for password for all 15 servers when I manually run it.
However , soon I would like to schedule this script... (4 Replies)
Discussion started by: ajaypatil_am
4 Replies
6. Shell Programming and Scripting
i have hundreds of thousands of txt files as below,
RADARSAT 1 SCENE DESCRIPTION
SCENE_ID c0005098
MDA ORDER NUMBER
GEOGRAPHICAL AREA CIS ScanSar Canada
SCENE START TIME APR 02 1997 23:05:10.222
SCENE STOP TIME APR 02 1997 23:02:49.695... (5 Replies)
Discussion started by: sunnydanniel
5 Replies
7. Shell Programming and Scripting
Hi all, I'm quite newbie in shell scripting but I found a problem what I cant solve.
I have a .txt file which looks like this:
/22/
/23/
/24/
and so on and I'd need to make it look like this:
/22/|/23/|/24/|...and so on.
these numbers are growing and has lines like this /2a/ as well.... (15 Replies)
Discussion started by: gergo235
15 Replies
8. Shell Programming and Scripting
Hi ...programmers...
I need a shell script to perform some specific task..
my txt file looks like this
netcdf new {
dimensions:
XAX1_11 = 11 ;
variables:
double XAX1_11(XAX1_11) ;
XAX1_11:point_spacing = "even" ;
XAX1_11:axis = "X" ;
float DEPTH(XAX1_11) ;... (19 Replies)
Discussion started by: Akshay Hegde
19 Replies
9. Shell Programming and Scripting
i have written my shell script in notepad however i am struggling to pass the data file to be read to the script the data file is of .txt format. My target is to run the shell script from the terminal and pass 3 arguments e.g. polg@DESKTOP-BVPDC5C:~/CS1420/coursework$ bash valsplit.sh input.txt... (11 Replies)
Discussion started by: Gurdza32
11 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
We've a VDI infrastructure in AWS (AWS workspaces) and we're planning to automate the process of provisioning workspaces. Instead of going to GUI console, and launching workspaces by selecting individual users is little time consuming. Thus, I want to create them in bunches from AWS CLI... (6 Replies)
Discussion started by: arun_adm
6 Replies
ZGREP(1) General Commands Manual ZGREP(1)
NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code:
(-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the
standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep.
If the GREP environment variable is set, zgrep uses it as the grep program to be invoked.
EXIT CODE
2 - An option that is not supported was specified.
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)
ZGREP(1)