LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2013, 08:51 AM   #1
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Rep: Reputation: 24
Automatic date stamp in arecord application


I am using Gnome-Schedule for my cron jobs.

This is the code I am using to record my show

arecord -t wav -f cd -d 8600 /home/randy/Desktop/IT.wav

At the moment my output file is names IT.WAV.

My code runs every sunday at 11:50am

Let's say I had to have my code record Tuesday's at 5pm. I would want it to automagically put the current date in the Desired format below.

Is it possible to have the output file automatically date stamped in this format every time I record.

Desired format: ITAUG0713

AUG is the month
07 is the day of the month
13 is the last two digits of the year
 
Old 08-28-2013, 09:27 AM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,163
Blog Entries: 10

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
Randy:
Try this
Code:
arecord -t wav -f cd -d 8600 /home/randy/Desktop/IT$(date "+%b%d%y").wav
output using echo here is
ITAug2813.wav
 
1 members found this post helpful.
Old 08-28-2013, 09:29 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
take a look at the date command.

the preferred method of sorting files by date is yyyy-mm-dd (or yy-julian-day-of-year).
 
1 members found this post helpful.
Old 08-28-2013, 09:43 AM   #4
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
This is the error I get. What do I do?

Code:
arecord -t wav -f cd -d 44 /home/randy/Desktop/TEST$(date "+%b%d%y").wav


Your command contains one or more of the character %, this is special for cron and cannot be used with Gnome-schedule because of the format it uses to store extra information on the crontab line. Please use the | redirector character to achieve the same functionality. Refer to the crontab manual for more information about the % character. If you don not want to use it for redirection it must be properly escaped with the \ letter.
 
Old 08-28-2013, 09:54 AM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
its telling you to put a \ in front of each %. the backslash escapes it so it isnt interpreted by the shell.
 
1 members found this post helpful.
Old 08-28-2013, 12:59 PM   #6
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
Beautiful!

That worked fine. Is there a way to capitalize Aug to AUG instead?

I learned something new today.

Thanks schneidz!!
 
Old 08-28-2013, 01:44 PM   #7
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,163
Blog Entries: 10

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
Quote:
Originally Posted by rmcellig View Post
I learned something new today.

Thanks schneidz!!
Yeah, me too.
 
Old 08-28-2013, 02:04 PM   #8
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
Here is how to capitalize. Put a ^ before the letter b in the code. Works fine for me now and again, I learned something new.
 
  


Reply


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
copy to a new directory and rename w/date stamp diamond_D Linux - Newbie 3 10-25-2010 05:49 PM
Regarding date-time-stamp problem smarty86 Programming 8 11-04-2009 10:57 PM
Automatic date stamp in text document gemini728 Linux - Newbie 3 02-25-2009 11:15 AM
date stamp file or directory name dgermann Linux - General 6 02-02-2008 05:53 PM
Rename file with date stamp MacSob Linux - General 6 09-13-2005 02:30 PM


All times are GMT -5. The time now is 08:55 AM.

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