SunQuest
           Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 5th, 2004, 06:58 PM
Scratchy Scratchy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 65 Scratchy Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 3 h 36 m 31 sec
Reputation Power: 0
need help with csh script

I am writing a script which is to search for some strings in a text file. When you execute the script like this "scriptname <argument>" it will output all the lines in the text file with the substring of the argument for example scriptname Bob will output all lines with Bob in them. I can do this easily enough with awk. The problem is, if you type scriptname bob, it will only match bob but not Bob. Unfortunately there is no way to ignore case with awk. How can I get around this? It is safe to assume that in the text file the substrings I search for will always start with a capital and be followed by lower case letters. So if there is a way to convert only the first letter of the argument to a capital, that would solve my problem. For example if the user types "scriptname bob" or "scriptname BOB" it should convert the argument bob or BOB to Bob. Is there a way I can convert only the first letter of the argument to a capital and convert the rest of the letters of that argument to lower case?

Reply With Quote
  #2  
Old February 6th, 2004, 09:38 AM
Perderabo Perderabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 121 Perderabo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 54 sec
Reputation Power: 5
That would not be easy in csh. You should consider switching to ksh or bash. They are much more powerful.

But I have another solution: use grep -i. With -i, grep will ignore case.

Reply With Quote
  #3  
Old February 6th, 2004, 11:53 AM
Scratchy Scratchy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 65 Scratchy Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 3 h 36 m 31 sec
Reputation Power: 0
Thanks grep worked!

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > need help with csh script


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway