pipe to file named with date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting pipe to file named with date
# 1  
Old 04-29-2011
pipe to file named with date

I would like to pipe (redirect ? - what is the right term?) the output of my script to a file named with the current date.

If I run this at a command prompt:
date +'%Y%m%d"
...it returns "20110429"

OK, that's good... so I try:
./script.sh > "'date +%Y%m%d'.csv"

I get a file named: 'date +%Y%m%d'.txt
...I would like the file to be named: 20110429.csv

Actually, I would like it to be named: log20110429.csv

Am I in left field, or not even in the ballpark?

Thanks,
-dog
# 2  
Old 04-29-2011
You'll have to use backticks:
Code:
./script.sh > `date +"%Y%m%d"`

This User Gave Thanks to kevintse For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to test named pipe file?

Hi ALL, How can I test a given file name exists and if it is a named pipe file in shell script ? Thanks............ (2 Replies)
Discussion started by: mycode.in
2 Replies

2. UNIX for Dummies Questions & Answers

Named pipe hanging?

Ok, I can't seem to figure this out or find anything on the web about this. I'm on Sun Solaris, UNIX. I have the following test script: #!/bin/ksh touch test.file LOG=./tmp.log rm -f ${LOG} PIPE=./tmp.pipe mkfifo ${PIPE} trap "rm -f ${PIPE}" EXIT tee -a ${LOG} < ${PIPE} & ... (17 Replies)
Discussion started by: Ditto
17 Replies

3. Shell Programming and Scripting

Processing a file list via named pipe

I have a ksh93 script I use that processes a file list in the order that they exist in the list. I would like to speed up processing of the list by having multiple processes handle it at once. I was thinking that perhaps a good way to handle this would be to write the list to a named pipe and some... (4 Replies)
Discussion started by: benalt
4 Replies

4. Programming

Named pipe behavior in Linux

Hi All ! I try to collect importent events from syslog and in my syslog conf, there is something like this: *.* |/logs/ipes/SLpipe1 I have a program, which opens this pipe and reads the messages from it. But how this pipe works ? Where can I probably read something about the details,... (3 Replies)
Discussion started by: mabra
3 Replies

5. Shell Programming and Scripting

Named pipe performance

Hi, I am getting data into a Named pipe. Does Named pipe have any size restriction; I know it does not have any storage and it just passes on the data to the next process. I want to know, if there will be a difference in the Named pipe performance if the data input is more. (I am using DB2... (1 Reply)
Discussion started by: sudvishw
1 Replies

6. Shell Programming and Scripting

cron a script and output to file named with date stamp

I can do this from the command line: /home/mylogin/tests/script.sh > /home/mylogin/tests/`date +"%Y%m%d"`log.csv It yields a file named: 20110429log.csv I would like to schedule with cron to run daily. when I enter the same line, as above in cron: 10 16 * * *... (3 Replies)
Discussion started by: landog
3 Replies

7. UNIX for Dummies Questions & Answers

Named Pipe contents to a file

I want to copy the contents of a named pipe to a file. I have tried using: cat pipe.p >> transcript.log but I have been unsuccessful, any ideas? (4 Replies)
Discussion started by: carl_vieyra
4 Replies

8. UNIX for Dummies Questions & Answers

Named PIPE

Gurus, I've a File Transaction Server, which communicates with other servers and performs some processing.It uses many Named PIPE's. By mistake i copied a named PIPE into a text file. I heard that PIPE files shouldn't be copied.Isn't it? Since it's a production box, i'm afraid on... (2 Replies)
Discussion started by: Tamil
2 Replies

9. Programming

IPC using named pipe

Hi All, I am facing a vague issue while trying to make two process talk to each other using named pipe. read process ========= The process which reads, basically creates FIFO using mkfifo - ret_val = mkfifo(HALF_DUPLEX, 0666) func. It then opens the pipe using open func - fd = open... (2 Replies)
Discussion started by: sharanbr
2 Replies

10. UNIX for Advanced & Expert Users

IPC using named pipe

Hi All, I am facing a vague issue while trying to make two process talk to each other using named pipe. read process ========= The process which reads, basically creates FIFO using mkfifo - ret_val = mkfifo(HALF_DUPLEX, 0666);) func. It then opens the pipe using open func - fd =... (1 Reply)
Discussion started by: sharanbr
1 Replies
Login or Register to Ask a Question