LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 07: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, 08:27 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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, 08:29 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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, 08:43 AM   #4
rmcellig
Member
 
Registered: Sep 2009
Posts: 252

Original Poster
Blog Entries: 1

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, 08:54 AM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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, 11:59 AM   #6
rmcellig
Member
 
Registered: Sep 2009
Posts: 252

Original Poster
Blog Entries: 1

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, 12:44 PM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

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

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

Original Poster
Blog Entries: 1

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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:19 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
Open Source Consulting | Domain Registration