Computing.Net > Forums > Unix > Script to Cat a file automatically

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Script to Cat a file automatically

Reply to Message Icon

Original Message
Name: Vik4sh
Date: September 29, 2004 at 05:25:35 Pacific
Subject: Script to Cat a file automatically
OS: Solaris 8
CPU/Ram: 500
Comment:

Can anyone help with using the following command:
cat /dev/null > XX (where XX is the filename)

I want to run this command through a script that runs every day.

Any ideas??



Report Offensive Message For Removal


Response Number 1
Name: thepubba
Date: September 29, 2004 at 14:05:01 Pacific
Reply: (edit)

#!/bin/ksh

touch XX

# The cat command is unecessary.

# You can also use:

# >XX


Set up your script to run from cron. If you want to create a new file every day, use the > syntax. If you simply touch a file that already exists, it will only change the date/time stamp. The contents will remain unchanged. Using > will create a new file.



Report Offensive Follow Up For Removal

Response Number 2
Name: anupam
Date: October 3, 2004 at 22:27:06 Pacific
Reply: (edit)

what the command "cat /dev/null > XX" does is that it just empties the contents of the file XX.It can be used to empty long log files.


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software