LinuxQuestions.org
Review your favorite Linux distribution.
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 03-29-2011, 05:00 PM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
date space in between not tab


Hi, I wonder how u can have space inbetween the dates:
Code:
echo `eval date +%m/%d/%Y(space here)%H:%M:%S` #space inbetween the date and the time.
echo `eval date +%m/%d/%Y%t%H:%M:%S` #this gives a tab in between
echo `eval date +%m/%d/%Y %H:%M:%S` #this simply returns error:
date: extra operand `%H:%M:%S'
Try `date --help' for more information.
Ive looked through the man, there are nothing mentioned about spaces, excepted for %_m, this is to add a space in front of a single digit rather than always.
Thanks,
Ted

Last edited by ted_chou12; 03-29-2011 at 05:03 PM.
 
Old 03-29-2011, 05:14 PM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

Why the eval? Anyway, anything not starting with % is simply printed. But the date command takes only one argument, so you need to put it in quotes.

Code:
date "+%m/%d/%Y %H:%M:%S"
 
Old 03-29-2011, 07:05 PM   #3
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431

Original Poster
Blog Entries: 32

Rep: Reputation: 3
Hi, Thanks that worked! I used eval because I was learning commands and functions from another script.
 
  


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
[SOLVED] how to distinguish between tab and space in a file akhand jyoti Linux - Newbie 3 03-22-2011 02:12 AM
Sed adds a space instead of tab at end of line kaprasanna1 Linux - Newbie 12 01-14-2011 09:24 AM
date value space prolbem jimmyjiang Red Hat 3 03-05-2008 12:24 AM
awk - working with space and tab indiancosmonaut Programming 7 07-10-2007 12:46 PM
Tab space in VI (M) ar1 Linux - Software 1 12-07-2003 11:47 PM

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

All times are GMT -5. The time now is 07: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