- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How can i view the space in a date when is from 01...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:30 AM
06-01-2006 07:30 AM
When i run ls -lrt date appears with a two spaces between "Jun" and "1"
australia:user1> ls -rlt
total 20
-rw-r--r-- 1 uno sapsys 992 Jun 1 13:25 message_error_server.txt
-rw-r--r-- 1 uno sapsys 147 Jun 1 13:25 message_error
If i run dia=`date "+%b %d"` appears
Jun 01
how can i use date command to show:
Jun 1 #two spaces between Jun and 1
or, how can i do to appear it?
I do something like this one
but it do not work.
dia=`date | cut -c5-10` # do not respect the spaces ...
Help please !!
Manuales.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:41 AM
06-01-2006 07:41 AM
Re: How can i view the space in a date when is from 01 to 09?
Well, you could filter the silly thing:
# date "+%b %d"|perl -pe 's/(...)0(\d)/$1 $2/'
...that's a space (blank) between $1 and $2.
...(or) if you if you don't care if there is only one space between the month and the day, use:
# date "+%b %0d"
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:43 AM
06-01-2006 07:43 AM
Re: How can i view the space in a date when is from 01 to 09?
Help please ..!!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:44 AM
06-01-2006 07:44 AM
Re: How can i view the space in a date when is from 01 to 09?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:47 AM
06-01-2006 07:47 AM
Re: How can i view the space in a date when is from 01 to 09?
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:50 AM
06-01-2006 07:50 AM
Re: How can i view the space in a date when is from 01 to 09?
1.- australia:user1> date "+%b %0d"
Jun 1
2.- australia:user1> date "+%b %d"|perl -pe 's/(...)0(\d)/$1 $2/'
Jun 1
3.- australia:user1> dia=`date "+%b %d"|perl -pe 's/(...)0(\d)/$1 $2/'`
4.- australia:user1> echo $dia
Jun 1
australia:user1>
how can i do to maintain the space?
Thanks ....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:52 AM
06-01-2006 07:52 AM
Re: How can i view the space in a date when is from 01 to 09?
Either the 'sed' or the 'perl' will work. The 'sed' solution is shorter and cheaper.
Your problems is (probably) that you did:
# da1=`date +'%b %d' | sed 's/ 0/ /'`
# echo ${da1} #...wrong!
# echo "${da1}" #...correct!!!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:54 AM
06-01-2006 07:54 AM
Re: How can i view the space in a date when is from 01 to 09?
please , look file at attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:54 AM
06-01-2006 07:54 AM
Re: How can i view the space in a date when is from 01 to 09?
>> Help please ..!!!!!
Don't know who that was for. attached is a script that demonstrates the sed option works.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:54 AM
06-01-2006 07:54 AM
Re: How can i view the space in a date when is from 01 to 09?
please , look file at attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:58 AM
06-01-2006 07:58 AM
Re: How can i view the space in a date when is from 01 to 09?
Oh, splat! Now I remember! Use this for space-fill. See the good-old-reliable manpages for 'date':
# date +'%b %e'
...no filter necessary!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 07:58 AM
06-01-2006 07:58 AM
Re: How can i view the space in a date when is from 01 to 09?
Jun 1
lt09:/home/merijn 109 > perl -MDate::Calc=Month_to_Text -le'@t=localtime;printf"%s %2d\n",Month_to_Text(++$t[4]),$t[3]'
June 1
lt09:/home/merijn 110 >
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:00 AM
06-01-2006 08:00 AM
Re: How can i view the space in a date when is from 01 to 09?
We both came up with %e
How wonderful this forum is ...
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:02 AM
06-01-2006 08:02 AM
Re: How can i view the space in a date when is from 01 to 09?
Ah, yes, but how wonderful you taught me to *first* think Perl! :-))
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:03 AM
06-01-2006 08:03 AM
Re: How can i view the space in a date when is from 01 to 09?
thanks a lot to all !!!!
and ....
o.k. that's works:
australia:user1> da1=`date +'%b %d' | sed 's/ 0/ /'`
australia1:user1> echo "${da1}"
Jun 1 #here there is a space ...
and .. do i use correctly the following sentence with if? i mean, using variable wich contains the value date above asked:
if [[ ! -n `cat ${logftp}_out | grep "${dia}" | grep "$file_delivered"` ]]
thanks....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:09 AM
06-01-2006 08:09 AM
Re: How can i view the space in a date when is from 01 to 09?
You wrote:
# if [[ ! -n `cat ${logftp}_out | grep "${dia}" | grep "$file_delivered"` ]] ...
This creates extra processes. 'grep' reads a file directly, so:
# if [[ ! -n `grep -e ${dia} -e "$file_delivered ${logftp}_out ]] ...
...should work...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:11 AM
06-01-2006 08:11 AM
Re: How can i view the space in a date when is from 01 to 09?
You wrote:
# if [[ ! -n `cat ${logftp}_out | grep "${dia}" | grep "$file_delivered"` ]] ...
This creates extra processes. 'grep' reads a file directly, so:
# if [[ ! -n "`grep -e ${dia} -e $file_delivered ${logftp}_out`" ]] ...
...should work...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:13 AM
06-01-2006 08:13 AM
Re: How can i view the space in a date when is from 01 to 09?
dia=`date "+%b %d"|perl -pe 's/(...)0(\d)/$1 $2/'`
is the software installed here? how can i verify it .. or is a command like awk or something like that??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:20 AM
06-01-2006 08:20 AM
Re: How can i view the space in a date when is from 01 to 09?
Perl is installed with HP-UX although more recent ports are available. Merijn offers at his own site a tremendous plethora!
http://mirrors.develooper.com/hpux/
You can get a reasonablly update binary for HP-UX here, too:
http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL
Generally, Perl is installed in '/opt/perl/bin/perl' and a symbolic link from 'usr/bin/perl' is created to point to it.
# perl -v
...returns your version. You should have at least 5.8.x
Perl is much more than 'awk' or 'sed' although it borrows from both plus the C language:
http://www.perl.org/about.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:26 AM
06-01-2006 08:26 AM
Re: How can i view the space in a date when is from 01 to 09?
you know, i have the following error in cron log:
putmthly_test.sh[56]: perl: not found.
but it worked !!!! any way do not worry , the important is that worked, why ? i do not why ...!!!
thanks for explanation ...
my server has: This is perl, version 5.005_02 built for PA-RISC1.1
why could have worked with above error shown?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:38 AM
06-01-2006 08:38 AM
Re: How can i view the space in a date when is from 01 to 09?
With regard to your crontab --- remember that by default, the environment provided by 'cron' has a default PATH of '/usr/bin' and '/usr/sbin' only.
Given that Perl is usually installed in '/opt' with a symbolic link from '/usr/bin' unless you have that link, this would fail for that reason.
More likely, thought, is that the Perl executable you have resides in '/usr/contrib/bin/perl' which is an *old* version provided by HP-UX. Since your PATH probably contains that, running 'perl...' from a normal shell finds the executable.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2006 08:55 AM
06-01-2006 08:55 AM
Re: How can i view the space in a date when is from 01 to 09?
REALLY, REALLY, THANKS !!!
Manuales.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2006 04:29 AM
06-02-2006 04:29 AM
Re: How can i view the space in a date when is from 01 to 09?
i want see Jun 02 instead of Jun (space)2
Thanks .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2006 05:03 AM
06-02-2006 05:03 AM
Re: How can i view the space in a date when is from 01 to 09?
dia=`date +'%b %d'`
Tanks ..