Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-29-2011, 06:00 PM   #1
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 430
Blog Entries: 30

Rep: Reputation: 2
date space in between not tab

Hi, I wonder how u can have space inbetween the dates:
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.

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

Rep: Reputation: 362Reputation: 362Reputation: 362Reputation: 362

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.

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

Original Poster
Blog Entries: 30

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


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

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