perform some checks on file using perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perform some checks on file using perl
# 1  
Old 02-22-2008
perform some checks on file using perl

hi

i want check for PVCS header in file if its present then check if its in proper format or not i want to do this is in perl on windows.

this is what i am doing :

1 . open file
2 . check for "PVCS information" if found then store the line no to $line var.
3 . check for "sccs" header
4 . if sccs header found then exit
5. close file
6 . if PVCS header found then call another subroutine with $line.
6.1 . again open the file skip lines till $line
6.2 . add 1 to $line and check for desired word
add 2 to $line and check for next word
.
.
6.3 . if header is in proper format then set a flag for each if statement and if all are set then return 0 or return 1 .
6.4 . close file.

now i am ready with small script for this ( which is in my office i will post it tomorrow ) but is there any better way of checking if PVCS header is in proper format or not ??

PVCS header sample :
Code:
     *** Start of PVCS information ***
     * $Workfile : 
     * $Author :
     * $Date :
     * $Log :
     ***********************

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to perform File Functions?

I have a Student File (rno, name, marks1, marks2, marks3) How do I display a student with the highest percentage and with a percentage between 50-60. and how to sort students in ascending order as per their name (1 Reply)
Discussion started by: Ankit Saraogi
1 Replies

2. Shell Programming and Scripting

Perform an action if certain text exist in output (PERL)

Hello, I'm attempting to write a tool that checks an IP address for existing PTR records then if there are no PTR records does a ping to see if it response. Then if there is no response, it should print a message saying This is what I have so far. #!/usr/bin/perl $nxdomain =... (4 Replies)
Discussion started by: spartan22
4 Replies

3. Shell Programming and Scripting

PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below, I need to check if $datevar is present in $filename. If so, i need to replace $filename with the values in the array. I need the output inside an ARRAY How can this be done. Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies

4. Shell Programming and Scripting

Perform Lookup File In Perl From One input File

Hi Perl Guru, I'm new to Perl Programming & need some help. I need to have some kind of similar code template so I can start to work on it. I'm been reading some forums and did not find anything that are similar so I start to work on it. I've been struggling on how to start it. Any... (1 Reply)
Discussion started by: devvvt168
1 Replies

5. UNIX for Dummies Questions & Answers

Daily File Checks

Hello all, I'm sorry if this is answered elsewhere, I've used the search function and can't find the specifics of what I'm after. I am brand new to playing with linux, and ideally I want to get better to help the company that I now work for. What I want to do: Create a script that I... (4 Replies)
Discussion started by: Aussiemick
4 Replies

6. Shell Programming and Scripting

Perl script that checks against Future time

Ok, so this may be an unusual request. But I have a certificate that expires sometime in may of 2011. Now, i have to monitor this certificate and alert when the current time is within 30 days of may 20, 2011. #!/usr/bin/perl # use Time::Local; # $sec=59; $min=59; $hours=23; $day=31;... (3 Replies)
Discussion started by: SkySmart
3 Replies

7. Shell Programming and Scripting

Script to perform record format checks

Hi All, I have a requirement to perform the following checks. Input file is a "|" delimited file and looks like this. A|c1|c2|c3|.... B|G1|G2|G3.... C|H1|H2|H3... A|c4|c5|c6|.... B|G4|G5|G6.... C|H4|H5|H6... Now the check is to see if all the "A" records have a corresponding B... (7 Replies)
Discussion started by: gsjdrr
7 Replies

8. UNIX for Advanced & Expert Users

speed test +20,000 file existance checks too slow

Need to make a very fast file existence checker. Passing in 20-50K num of files In the code below ${file} is a file with a listing of +20,000 files. test_speed is the script. I am commenting out the results of <time test_speed try>. The normal "test -f" is much much too slow when a system... (2 Replies)
Discussion started by: nullwhat
2 Replies

9. Shell Programming and Scripting

to perform checks line by line on a file

Hi, I have a file abc.txt with data like this 1 /test/ 2 /test/file.txt 3 /data/ 4 /data/file1.txt 5 /data/file2.txt I want to take out every path from the file and check if its a directory or file. I am trying it with cut with something like this but it doesnt work ... (7 Replies)
Discussion started by: muaz
7 Replies

10. UNIX for Advanced & Expert Users

Doing Checks on a file

I have a process that I am trying to provide a solution for and have hit a brick wall and would like some pointers in the right direction. Basically on a daily basis a report is automatically generated in a CSV format (FIRST.CSV) which includes codes and amounts in the following format: ... (6 Replies)
Discussion started by: SAMZ
6 Replies
Login or Register to Ask a Question