The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sh : Problem with the result of a find command frenchwill Shell Programming and Scripting 4 08-07-2008 04:43 AM
Grabbing result of sql command hern14 UNIX for Dummies Questions & Answers 3 07-23-2008 03:40 PM
echo command result umen UNIX for Dummies Questions & Answers 2 11-10-2005 08:39 AM
FTP command result nymus7 IP Networking 1 08-08-2005 06:01 PM
Interpretting the result of TOP command sanjay92 UNIX for Dummies Questions & Answers 2 09-21-2001 06:50 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 3.50 average. Display Modes
  #1 (permalink)  
Old 09-08-2008
ladtony
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
how to get a space between the result of (date +%d) command

Hi

I want to insert a space between the result of the following command.

day=$(date %d)
i get the result as ------- Sep 2
i want to get the result as Sep 2(two space between Sep and 2)
how can i get this...
is this possible wid awk??
  #2 (permalink)  
Old 09-08-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,927
Code:
$ date '+%b %e'
Sep   8
$
  #3 (permalink)  
Old 09-08-2008
ladtony
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
am using ksh
and am getting the error as +%b %e not found
  #4 (permalink)  
Old 09-08-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Are you using incorrect quotes? The error message sounds like you are using backticks (ASCII 96) not regular straight quotes.
  #5 (permalink)  
Old 09-08-2008
ladtony
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
i am using the straight quotes only.....
now i got that but the space is not added...
am getting the same result
  #6 (permalink)  
Old 09-08-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink What about the following

Code:
> date | awk '{print $2," "$3}'
Sep  8
or
Code:
> date | cut -d" " -f2-4
Sep  8
  #7 (permalink)  
Old 09-08-2008
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,175
The spaces are there. You'll need to use double quotes to see them!

fred=`date '+%b %e'`

echo $fred
Sep 8

echo "$fred"
Sep 8
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0