Counting Number of times a File is accessed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Counting Number of times a File is accessed
# 1  
Old 04-11-2005
Lightbulb Counting Number of times a File is accessed

Hi,

I need to count the number of times a script is accessed from within the script. Is it possible ?

Example: I have a script called lo.sh and i execute the script for the first time, then the counter variable declared inside the lo.sh should increment by 1. For every execution the counter has to be incremented by 1.

Any help is appreciated !!!!!!!!
# 2  
Old 04-11-2005
Tools Try logging the count

Try logging the count in a temporary file.
When you next access, read the count, increment and overwrite to temporary file.

Regds,
Rishi
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Counting number of times content in columns occurs in other files

I need to figure out how many times a location (columns 1 and 2) is present within a group of files. I figured using a combination of 'while read' and 'grep' I could count the number of instances but its not working for me. cat file.txt | while read line do grep $line *08-new.txt | wc -l... (6 Replies)
Discussion started by: ncwxpanther
6 Replies

2. Homework & Coursework Questions

Accepting a phrase and counting the number of times that it is repeated in a specific website

1. The problem statement, all variables and given/known data: Develop a shell script that accepts a phrase and counts the number of times that it is repeated in a specific website. Note: Im not sure if it's the whole website, or just a specific page but im guessing its thewhole website. ... (2 Replies)
Discussion started by: Zakerii
2 Replies

3. Solaris

Dtrace-counting the number of read access to a file

Hi, I want to write a script with dtrace to count the number of read and write from and to a file. I use this for reading: dtrace -n 'syscall::read:entry { @ = count(); }' but it doesn'f give me a single answer. The result is always increasing. :wall: Please use next time code tags... (0 Replies)
Discussion started by: golabi
0 Replies

4. UNIX for Dummies Questions & Answers

how to count number of times each word exist in a file

I'm trying to count the number of times each word in the file exist for example if the file has: today I have a lot to write, but I will not go for it. The main thing is that today I am looking for a way to get each word in this file with a word count after it specifying that this word has... (4 Replies)
Discussion started by: shnkool
4 Replies

5. Shell Programming and Scripting

Counting number of files that contain words stored in another file

Hi All, I have written a script on this but it does not do the requisite job. My requirement is this: 1. I have two kinds of files each with different extensions. One set of files are *.dat (6000 unique DAT files all in one directory) and another set *.dic files (6000 unique DIC files in... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

6. Shell Programming and Scripting

Counting script how many times it run?

i should use this script runs how many times before ? how can i do_? (3 Replies)
Discussion started by: utoptas
3 Replies

7. UNIX for Dummies Questions & Answers

Number of files accessed this week

I have looked around on the internet and still i am no wiser as to how to show the number of files in a directory that have been accessed this week and also that as a percentage. Any help would be much appreciated. (5 Replies)
Discussion started by: RAFC_99
5 Replies

8. UNIX for Dummies Questions & Answers

Counting the number of times a character appears

I am looking for a bash command that counts the number of times a character appears in a file. For example "I am a newbie, trying to learn shell script". Then the command counts the number of e and gives them as 4. Also I want one that counts the number of times a character in a string is replaced.... (2 Replies)
Discussion started by: #moveon
2 Replies

9. Programming

maximum number of times - a file can be opened

Hi All, We can find the maximum of open file descriptors in hold with respect to a process. As default size was 256 (with getrlimit) and the hard limt was 65536 I tried changing the limit to 1024(with setrlimit) successfully changed the limit but still I couldnt have as many open file... (3 Replies)
Discussion started by: matrixmadhan
3 Replies

10. UNIX for Dummies Questions & Answers

Counting The Number Of Duplicate Lines In a File

Hello. First time poster here. I have a huge file of IP numbers. I am trying to output only the class b of the IPs and rank them by most common and output the total # of duplicate class b's before the class b. An example is below: 12.107.1.1 12.107.9.54 12.108.3.89 12.109.109.4 12.109.6.3 ... (2 Replies)
Discussion started by: crunchtime
2 Replies
Login or Register to Ask a Question