LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-24-2009, 10:08 AM   #1
jeewiz
LQ Newbie
 
Registered: Jan 2007
Distribution: CentOS 6.5
Posts: 21

Rep: Reputation: 0
String of text conversion


I'm writing a centralized logging piece, and I need to grep out logs that have specific date tags. The date command returns abbreviated months (Sep), via "#date -d yesterday '+%b'" but I need it all caps. ie SEP vice Sep. Otherwise the grep doesn't catch it. Any ideas?


edit...going to use "grep -i" in the meantime until a better solution comes along

Last edited by jeewiz; 09-24-2009 at 10:10 AM.
 
Old 09-24-2009, 10:22 AM   #2
mjones490
Member
 
Registered: Sep 2005
Distribution: LFS
Posts: 60

Rep: Reputation: 22
The -i option (on grep) tells grep to ignore case.

Edit: You beat me to it.
 
Old 09-24-2009, 10:35 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
How complex and necessary is it to parse out the abbreviated month only from the log entries? Would it matter if you translated say "Decision" in the log text to "DECision"? sed is probably the best tool for the job ...
 
Old 09-24-2009, 11:10 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
When generating the date (mth) string, pass it through tr
$ echo 'linux' | tr "[:lower:]" "[:upper:]"
http://www.cyberciti.biz/faq/how-to-...ix-tr-command/
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
search string in text and print string wolfipa Linux - Software 4 09-17-2009 08:50 AM
Easy string/text manipulation/indentation for restructured text brianmcgee Linux - Software 1 04-22-2008 08:27 PM
C++ String to double conversion americanforest Programming 4 10-23-2007 09:44 PM
problem in string to float conversion..C++ fs11 Programming 3 01-15-2007 06:28 PM
C++ string to integer conversion fatman Programming 6 06-18-2006 08:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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