LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   String of text conversion (https://www.linuxquestions.org/questions/linux-general-1/string-of-text-conversion-757503/)

jeewiz 09-24-2009 10:08 AM

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

mjones490 09-24-2009 10:22 AM

The -i option (on grep) tells grep to ignore case.

Edit: You beat me to it. :)

catkin 09-24-2009 10:35 AM

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 ...

chrism01 09-24-2009 11:10 PM

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/


All times are GMT -5. The time now is 12:11 AM.