LinuxQuestions.org
Help answer threads with 0 replies.
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 10-15-2014, 04:11 AM   #16
nisagnel
LQ Newbie
 
Registered: Mar 2010
Location: India
Distribution: Centos
Posts: 28

Rep: Reputation: 2

Hi evo2,

can it be used like the following?

cal | head -n1 | awk '{print $1}' | tr '[:lower:]' '[:upper:]'

I am not sure why we cannot use [a-z] and [A-Z].I have checked the man page of tr.it suggests to use '[:lower:]' '[:upper:]'.
 
Old 10-15-2014, 04:47 AM   #17
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,
Quote:
Originally Posted by nisagnel View Post
can it be used like the following?

cal | head -n1 | awk '{print $1}' | tr '[:lower:]' '[:upper:]'

I am not sure why we cannot use [a-z] and [A-Z].I have checked the man page of tr.it suggests to use '[:lower:]' '[:upper:]'.
Well, I was trying to get the OP to read the man pages... but it looks like you did. Why are you messing with head and awk though? Only cal and tr should be used/needed.

Evo2.
 
Old 10-15-2014, 08:20 AM   #18
nisagnel
LQ Newbie
 
Registered: Mar 2010
Location: India
Distribution: Centos
Posts: 28

Rep: Reputation: 2
ok.got it.

I thought hello111 needs only the name of the month in upper case.that's why i used awk and head.
 
Old 10-15-2014, 10:23 AM   #19
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,505

Rep: Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434Reputation: 2434
you do not need head if you have awk (my god):
Code:
cal | awk '{ print toupper($1); exit }'
 
1 members found this post helpful.
Old 10-15-2014, 09:48 PM   #20
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,
Quote:
Originally Posted by nisagnel View Post
I thought hello111 needs only the name of the month in upper case.that's why i used awk and head.
Ahh, ok. It seems we had different interpretations of:

Quote:
Display the current month using 'cal', translating to uppercase using 'tr'.
You're thinking the name of the month while I'm thinking the calendar for the month. My interpretation was mainly based on the limited tool set (cal and tr) that the question mentioned.

Cheers,

Evo2.
 
Old 10-15-2014, 11:20 PM   #21
hello111
LQ Newbie
 
Registered: Oct 2014
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks you guys. I got it finally
it is:
cal | tr "[a-z]" "[A-Z]"
 
  


Reply


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
Slackware64 --current (XFCE) - Laptop + external display, enabling disabled display slaka Slackware 0 11-03-2013 03:44 AM
Display the percentage of increase in data size for each month Bunty2013 Linux - Newbie 2 10-21-2013 01:21 PM
LXer: cal & ncal Linux Commands To Display Calendar Information LXer Syndicated Linux News 0 07-18-2013 07:40 PM
How to find/display out last Friday's date of the month sunnysthakur Linux - General 11 03-29-2013 04:09 AM
display month format in 2 digit coolplanet Programming 7 06-07-2009 09:55 PM


All times are GMT -5. The time now is 10:10 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration