selection of files based on its types


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users selection of files based on its types
# 1  
Old 02-04-2008
Java 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  
Old 02-04-2008
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  
Old 02-04-2008
Error

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  
Old 02-04-2008
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash selection of files with similar name

Hi all, This is my first day on Linux shell!!! So, I am trying to write a script that that will pick up pairs of files with the same name (not the same content) but that are different in one character (one is *R1 the other is *R2)... Something like: look ate the files, whenever they are the... (3 Replies)
Discussion started by: ALou
3 Replies

2. UNIX for Advanced & Expert Users

Recursive grep with only certain types of files

Can I please have some ideas on how to do a recursive grep with certain types of files? The file types I want to use are *.c and *.java. I know this normally works with all files. grep -riI 'scanner' /home/bob/ 2>/dev/null Just not sure how to get it to work *.c and *.java files. (5 Replies)
Discussion started by: cokedude
5 Replies

3. Shell Programming and Scripting

Sed or awk : pattern selection based on special characters

Hello All, I am here again scratching my head on pattern selection with special characters. I have a large file having around 200 entries and i have to select a single line based on a pattern. I am able to do that: Code: cat mytest.txt | awk -F: '/myregex/ { print $2}' ... (6 Replies)
Discussion started by: usha rao
6 Replies

4. Shell Programming and Scripting

Remove two types of files from a directory

Hi All, i need to move two types of files from a directory. I have used the below command to find the files from the directory.. SOURCE_DIR="some directory path" TARGET_DIR="Target Dir" Datestamp=Date_format find $SOURCE_DIR \( -name "*.log" -o -name "*.out" ) - exec ls -1 {} \; now i... (9 Replies)
Discussion started by: ch33ry
9 Replies

5. UNIX for Dummies Questions & Answers

display types of files using metacharacters

1) I want to display all the files in a directory that start with the word chapter, are followed by a digit 1,2,6,8, or 9 and end with .eps or .prn so I came up with this file ~/temp/chapter.eps ~/temp/chapter.prn but is there a better way, i.e. combining both file types into the command? ... (2 Replies)
Discussion started by: dunsta
2 Replies

6. Shell Programming and Scripting

Print selection of line based on line number

Hi Unix gurus Basically i am searching for the pattern and getting the line numbers of the grepped pattern. I am trying to print the series of lines from 7 lines before the grepped line number to the grepped line number. I am trying to use the following code. but it is not working. cat... (3 Replies)
Discussion started by: mohanm
3 Replies

7. Shell Programming and Scripting

Help - Bug: A script to compile two types of data files into two temporary files

Dear other forum members, I'm writing a script for my homework, but I'm scratching all over my head and still can't figure out what I did wrong. Please help me. I just started to learn about bash scripting, and I appreciate if anyone of you can point out my errors. I thank you in advance. ... (3 Replies)
Discussion started by: ilove2smoke
3 Replies

8. Shell Programming and Scripting

selection of context in files

I have a file like this QUEUE: <ITEM(69)> "/NLA///ACHO_EQU_IDX" Q_KEY: <ITEM(69)> "/NLA///ACHO_EQU_IDX" Q_TYPE: <VSTR(32)> "GEN_VSTR_INDEX" ... (1 Reply)
Discussion started by: manas_ranjan
1 Replies

9. Shell Programming and Scripting

Find duplicates from multuple files with 2 diff types of files

I need to compare 2 diff type of files and find out the duplicate after comparing each types of files: Type 1 file name is like: file1.abc (the extension abc could any 3 characters but I can narrow it down or hardcode for 10/15 combinations). The other file is file1.bcd01abc (the extension... (2 Replies)
Discussion started by: ricky007
2 Replies

10. UNIX for Dummies Questions & Answers

find directory with 2 types of files

Trying to use the find command to find any directory which contains a file ending in .zip AND a file ending in .o I'm having trouble specifying multiple files as criteria and have can't seem to figure it out from Unix in a Nutshell and Google. (2 Replies)
Discussion started by: dangral
2 Replies
Login or Register to Ask a Question