The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find duplicates from multuple files with 2 diff types of files ricky007 Shell Programming and Scripting 2 03-04-2008 01:46 PM
Merge files based on key sbasetty Shell Programming and Scripting 3 02-02-2007 06:05 PM
merging two files based on some key Vandana Yadav Shell Programming and Scripting 1 02-03-2006 09:45 AM
Remove files based on date hshapiro UNIX for Dummies Questions & Answers 4 12-09-2005 12:21 PM
find directory with 2 types of files dangral UNIX for Dummies Questions & Answers 2 10-13-2004 02:51 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-04-2008
ganapati's Avatar
ganapati ganapati is offline
Registered User
  
 

Join Date: Jul 2006
Location: Mysore
Posts: 125
Post selection of files based on its types

Daily we are getting some datafiles to our unix server location FTPIN.

Incoming File names will be present in the location "/xyz/test/" as below:

"infile_A1_YYYYMMDD",
"infile_A2_YYYYMMDD",
"infile_B1_YYYYMMDD",
"infile_C1_YYYYMMDD"
"infile_C2_YYYYMMDD"

Where A, B and C are the different file types with the number of files (1,2,3..) for that type.

There will be a file indicator for these file types either "Y" or "N" declared in
seperate file (PCP file) as below:

export A=Y
export B=N
export C=Y

Iam executing this PCP file to setup the values before running my script.

I've to create a script to select the files which has the file indicator as "Y"
for the files types A, B and C and extract the data records from these files to a single file.

My question is how to check the file indicator for these file types which is declared in some other script
through my script? Also how to select the files which has the file type as "Y"?


Please guide me...

With Regards / Mysore Ganapati
  #2 (permalink)  
Old 02-04-2008
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Hi
Quote:
Iam executing this PCP file to setup the values before running my script.
You may trying sourcing the PCP file from within this script,so that you can access the definitions of the same.

For ksh,
. ~/yourPCPFile
For Csh
source ~/yourPCPFile


Thanks
Nagarajan G
  #3 (permalink)  
Old 02-04-2008
ganapati's Avatar
ganapati ganapati is offline
Registered User
  
 

Join Date: Jul 2006
Location: Mysore
Posts: 125
Exclamation

Hi Nagaraj,

Iam executing the PCP file which has file_type declaration.
Next I've run my Unix script to select the files which has the file type as "Y". Here Iam facing the problem.
I heard using "env" we can get the environment value set during execution of PCP. but I dont know how to check which are the file types has set to type "Y" using env output.

If you can help me it would be a great help for me...

Thanks in advance / Ganapati
  #4 (permalink)  
Old 02-04-2008
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
The values set by executing the PCP file is available only for that shell,as your shell script will spawn a new shell to execute the values exported in the PCP file are not available to the Shell script.

In your script file you need to add a line to execute the PCP file ahead of any computations based on the definitions on that PCPfile.

Thank
Nagarajan G
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0