Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

I am using CentOS 5.5. There is a CSV file in a particular directory(/somewhere/somefile.csv) where a software continuously appending comma separated row(s) of data time to time and the file size is growing big (currently it's 50MB+).

My idea is to create a demon to watch the CSV file. Whenever any row(s) of data appended in that CSV file the demon will read the last appended row(s) and create/write it in a separate text file by date.

I would like to know:

  • Is there any shell script/software available on this regards to watch a CSV file?
  • Is there any better idea or solutions other then create a demon?

I have googled tons of time but didn't find any good idea/solution(s). Please help.

Thanks in advance.

asked 18 Jul '12, 03:23

tanveer's gravatar image

tanveer
112
accept rate: 0%




You could avoid having to write any script by using Rsyslog. It allows you to use a regular file as input and write output to a file name according to a template (for example date as file name, without syslog time stamp).

link

answered 22 Jul '12, 03:49

unSpawn's gravatar image

unSpawn
811
accept rate: 28%

I would consider using some form of source revision control like git. I think you might be able to get what you need without having to reinvent too many wheels.

link

answered 20 Jul '12, 11:20

mww's gravatar image

mww
111
accept rate: 0%

You can try inotify or incron.

Starting with kernel 2.6.13, Linux provides the inotify mechanism, which allows an application to monitor file events.

http://inotify.aiken.cz/

or you can write your own program as described on http://www.ibm.com/developerworks/linux/library/l-ubuntu-inotify/index.html

link

answered 01 Aug '12, 03:33

savotije's gravatar image

savotije
1
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×8
×6

Asked: 18 Jul '12, 03:23

Seen: 2,469 times

Last updated: 01 Aug '12, 03:33

powered by OSQA