Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-10-2004, 03:53 AM   #1
LQ Newbie
Registered: Aug 2003
Posts: 10

Rep: Reputation: 0
Question Creating a file like "DATE.txt"


i'm running a daily cronjob (simple snmpgets written in bash) and want the output being written into a file DATE.txt.
any suggestions?

TIA, Parker

Last edited by parker; 03-10-2004 at 04:08 AM.
Old 03-10-2004, 04:38 AM   #2
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint
Posts: 9,716

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
command > DATE.txt
Old 03-10-2004, 04:38 AM   #3
Registered: Jun 2003
Location: Reading, UK
Distribution: Debian 3.0, LFS
Posts: 524

Rep: Reputation: 37
Something like this:
variables=predefined strings
cat >> DATE.txt << EOF
Write whatever you want to go into the file here
You can use $variables if you want to
To end input, type:
Will give you a file that looks like this:

Write whatever you want to go into the file here
You can use predefined strings if you want to
To end input, type:

Also you can use:
echo -e "Some text that you want\nThe -e option allows for special characters" >> DATE.txt

Again you can use variables. The ">>" means append, but you can use ">" if you want to start a new file in both cases.
Old 03-10-2004, 04:54 AM   #4
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
Not too sure, but do you mean more how can you create a file DATE.txt where DATE is today's date? You can use the date command to create a filename for yourself. For example:

run_program > "`date +%Y%m%d%H%M%S`.txt"
Will attach the standard out of `run_program' to a file of the format YYYYMMDDHHMMSS.txt, I think this is what you mean?
Old 03-10-2004, 05:44 AM   #5
LQ Newbie
Registered: Aug 2003
Posts: 10

Original Poster
Rep: Reputation: 0
that's it cjcuk

thanks a lot, thats what i was looking 4.

cu, parker


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"creating symbolic link" "operation not permitted" wheni Linux - Newbie 3 05-08-2011 02:36 AM
cannot exit normally after "nohup blablabla > output.txt &" LQYY Linux - Newbie 1 12-14-2004 11:02 AM
Could someone please post "upgrade.txt"... tigerflag Slackware 2 06-27-2004 05:52 PM
Creating an "all in one" install file? Agileuk Linux - General 1 10-07-2003 06:16 AM
Monthly Archiving Script... help with "date" & "cron" Supp0rtLinux Linux - Software 3 01-03-2003 10:29 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration