Check on the files expected to be of single version


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check on the files expected to be of single version
# 1  
Old 03-30-2010
Data Check on the files expected to be of single version

I need to put a check for the files that are expected to come from source as single version but if they are coming in multiple version, i need to fail the job.also .from the soource some multiple files ll be coming that are required.

e.g.5 files are coming from source.
aaa
bbb
ccc
ddd
eee
out of these aaa and bbb are multiversioned file(aaa_c1,aaa_c2,bbb_c1,bbb_c2) and rest are single versioned.so i need to prepare a code that can copy both types of files and also check that there should not be multi version of files for the files ccc, ddd and eee
# 2  
Old 03-30-2010
... and what code have you written so far?
# 3  
Old 03-30-2010
Quote:
out of these aaa and bbb are multiversioned file(aaa_c1,aaa_c2,bbb_c1,bbb_c2) and rest are single versioned.
where are these files exist? in the same directory?
# 4  
Old 03-30-2010
yes all the files are in the same directory

---------- Post updated at 01:35 AM ---------- Previous update was at 01:34 AM ----------

Quote:
Originally Posted by Neo
... and what code have you written so far?

Code:
for name in `cat /tmp/cdw.txt`
do 
files=`ls $name*`
for file in $files
do
cp -p $SOURCE_DIR/$file $IN_DIR/$file
TmpRtnCd=$?
        if [[ $TmpRtnCd -ne $SuccessCd ]];then
                echo "[ERROR] Error $file is not found at source"
                exit $FailedCd
        fi
if  [ "$name" = "ecs_universe.dat" -o "$name" = "ecs_carveout" -o "$name" = "Goal_ecs_ctrl.txt" ];then
echo "[INFO] Files expected of single version are found"



---------- Post updated at 01:46 AM ---------- Previous update was at 01:35 AM ----------

hey ny body with code ......plz help me asap.
thanks in advance

Last edited by pludi; 03-30-2010 at 03:37 AM.. Reason: code tags, please...
# 5  
Old 03-30-2010
like this?


Code:
while read file
do
   count=$(ls -1 $file* | wc -l)
   if [ "$count" -eq 1 ]; then
        echo "PASS"
   else
        echo "FAIL"
   fi
done < file.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to check tar version in Solaris?

for pkg in `pkginfo | grep tar | grep application | awk '{print $2}'`; do pkginfo -l $pkg | grep VERSION; done Please use CODE tags as required by forum rules! (2 Replies)
Discussion started by: svijayas
2 Replies

2. Shell Programming and Scripting

Paste 2 single column files to a single file

Hi, I have 2 csv/txt files with single columns. I am trying to merge them using paste, but its not working.. output3.csv: flowerbomb everlon-jewelry sofft steve-madden dolce-gabbana-watchoutput2.csv: http://www1.abc.com/cms/slp/2/Flowerbomb http://www1.abc.com/cms/slp/2/Everlon-Jewelry... (5 Replies)
Discussion started by: ajayakunuri
5 Replies

3. HP-UX

How to check Oracle version on HP-UNIX?

Dear Gurus, I am totally new to HP-UNIX. Can you please help me that how can i check the detail version of Oracle on HP-UNIX. My administrator give me command for linux as below. select * from v$version; (Login to the database using Sql*Plus and connect as Sys user.) Please see... (3 Replies)
Discussion started by: imtiaza
3 Replies

4. Solaris

How to check SVM version Solaris 9 and 10?

How to check Solaris Volume Manager Version in 9 & 10? Which are the packages that are installed in the SVM? (1 Reply)
Discussion started by: ajhal04
1 Replies

5. Solaris

Command to check firmware version

Command to check firmware version of HP x86 server on which solaris installed. I m not getting version by using prtdiag -v command (1 Reply)
Discussion started by: sunray
1 Replies

6. Shell Programming and Scripting

Check for the bit version of OS

Hi , Is there a command that i can use to check the bit version of the OS. I have a script that i need to run on all the unix flavors so how do i check for the condition say something like this if( 32 bit) { execute this } else { execute this (4 Replies)
Discussion started by: tcsprak
4 Replies

7. Solaris

How to check version of Solaris?

Hi All, Looks a foolish question, but please can someone tell me the command to check version of Solaris OS? Thanks, Am (5 Replies)
Discussion started by: am_yadav
5 Replies

8. Solaris

Check version of Oracle

Hi All, Please advice me how i can check the Oracle version on my UNIX Solaris machine without logging in to oracle? Thanks, Am (1 Reply)
Discussion started by: am_yadav
1 Replies

9. Shell Programming and Scripting

Single v. double quotes in sed (GNU utilities for Win32 version)

I'm using sed for Windows at a WinNT command prompt. Wrapping the expressions with single quotes doesn't work. I have to use double quotes. Is this the norm for the Windows implementation? (2 Replies)
Discussion started by: daddydojo
2 Replies

10. Programming

to check version to library

how to check the version of Library version of Program & version of file. while compile pro*c program, I got error like elf error: no string table if u have any suggestion then give me urgently. (1 Reply)
Discussion started by: dilipluhar
1 Replies
Login or Register to Ask a Question