Help in finding files & processing them


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help in finding files & processing them
# 1  
Old 06-19-2009
Help in finding files & processing them

Hi All,

I have a requirement to search 3 files in a directory and process them after they arrive. I know the names of the files and also the directory where I have to search them. These things are going to be constant.

I used the "test -f" command to search a single file. That is working fine.

while ( test ! -f $P_DATA_FILE_PATH/$P_DATA_FILE_NAME)
do
sleep 10
done

The code above searches the file until it arrives. Now I want to check existence of 3 files & process each file separately when it arrives. I tried using the logical OR (||) by giving ( test ! -f $P_DATA_FILE_PATH/$P_DATA_FILE_NAME) || ( test ! -f $P_DATA_FILE_PATH/$P_DATA_FILE_NAME1) condition. But it does not work.

Can somebody help?
# 2  
Old 06-19-2009
Bourne shell syntax:

Code:
$  [ condition1 -o condition2 ]

Korn shell syntax:

Code:
$  [[ condition1 || condition2 ]]

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Infrastructure Monitoring

Event processing & machine learning in monitoring system

Hello! For a couple of years I'm developing an IT infrastructure monitoring system in the research group in my university. And now we would like to use some nontrivial methods in this area. So, I decided to contact with experienced users on the subject. My questions would be: Do existing... (3 Replies)
Discussion started by: pyalxx
3 Replies

2. Shell Programming and Scripting

Help in finding & comparing avg file size

I have some files in a directory with two different extensions which get created everyday. Can you please help me out in getting the average file size for both these extensions and checking it with the last two file sizes of the same file extension ? To be more clear.. Lets say I have 10 files... (1 Reply)
Discussion started by: kiran1112
1 Replies

3. Shell Programming and Scripting

Finding a text in files & replacing it with unique strings

Hallo Everyone. I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text. I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern> ... (5 Replies)
Discussion started by: gordom
5 Replies

4. Shell Programming and Scripting

Finding & Copying files

Hello :) can someone please help me with this task: I am in the shell, in folder "Main" below the folder Main are sub folders: "sourceA", "Source B", and "target" in sourceA and source B are files, and in folder "Main" is a textfile, with filenames, one filename per line. I need a... (4 Replies)
Discussion started by: Y-T
4 Replies

5. Shell Programming and Scripting

Finding a flatfile & deleting first line

I have a small script where I want to see if a file exists & then delete the first line from it. I have code to help me find if the file exists, but I am unsure as to how to then take in the answer and remove the first line from the flatfile: This is what I have so far just to output if the... (3 Replies)
Discussion started by: fatalxkiss
3 Replies

6. UNIX for Dummies Questions & Answers

Finding & Replacing specific Fields

All I have a very large file (aproximately 150,000) as shown below separated by pipe "|". I need to replace data in 2, 16, 17, 23 fields that are of time stamp format. My goal is to look in those fields and it ends with "000000|" then replace it with "000|". In other words, make it as 6 digit... (2 Replies)
Discussion started by: ddraj2015
2 Replies

7. Shell Programming and Scripting

help with finding & replacing pattern in a file

Hi everyone. Could u be so kind and help me with on "simple" shell script? 1. i need to search a file line by line for a pattern. example of a lines in that file 2947 domain = feD,id = 00 0A 02 48 17 1E 1D 39 DE 00 0E 00,Name Values:snNo = f10 Add AttFlag = 0 2. i need to find... (0 Replies)
Discussion started by: dusoo
0 Replies

8. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

9. Shell Programming and Scripting

Finding pattern & prepending a line with text

Hello Dudes, I have a task to make a unix shell script that should search for a specific TEXT in a file.If that TEXT is found, shell script should add a comment statement before that TEXT line. Ex : LINE 1 xxxxx LINE 2 xxxx CALL xxxx LINE 3 xxxx PERFORM UNTIL if i... (1 Reply)
Discussion started by: kirrushna
1 Replies
Login or Register to Ask a Question