Sponsored Content
Top Forums Shell Programming and Scripting Change case preserving the same case Post 302643121 by vanessafan99 on Friday 18th of May 2012 01:02:27 PM
Old 05-18-2012
Change case preserving the same case

how can i do a case insensitive search/replace but keep the same case?

e.g., i want to change a word like

apple-pie to orange-cake

but for the first word if the first letter of the keyword or the letter after the - is capitalised i want to preserve that

e.g., if the before is:

Apple-pie

output should be:
Orange-cake

If the before is: Apple-Pie
output should be Orange-Cake

thanks
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies

2. Shell Programming and Scripting

Script needed to select and delete lower case and mixed case records

HELLO ALL, URGENTLY NEEDED A SCRIPT TO SELECT AND DELETE LOWER AND MIXED CASE RECORDS FROM A COLUMN IN A TABLE. FOR EXAMPLE : Table name is EMPLOYEE and the column name is CITY and the CITY column records will be: Newyork washington ... (1 Reply)
Discussion started by: abhilash mn
1 Replies

3. Shell Programming and Scripting

convert upper case to lower case in ascript

I have a package to install and the installation script which does it . The files/directories names in the script are all lower case but the actual package has everything in upper case - file names, directories . I don't want to rename directories and files in the package - it has a lot of them . ... (2 Replies)
Discussion started by: vz6zz8
2 Replies

4. Shell Programming and Scripting

Script to Convert Upper case to Lower case

Hi All I have a script which extracts values from a Database (A persons name) and puts it into a variable in my script IE: $NAME However the Value in the DB is all in uppercase and contains the users first name and last name EG: > echo $NAME GRAHAM BOYLE > What I need is only the... (7 Replies)
Discussion started by: grahambo2005
7 Replies

5. Shell Programming and Scripting

data array needs to change upper case to lower case

Hi all, i have a data array as followes. ARRAY=DFSG345GGG ARRAY=234FDFG090 ARRAY=VDFVGBGHH so on.......... i need all english letters to be change to lower case. So i am expecting to see ARRAY=dfsg345ggg ARRAY=234fdfg090 ARRAY=vdfvgbghh so on........ If i have to copy this data in... (8 Replies)
Discussion started by: usustarr
8 Replies

6. Shell Programming and Scripting

sed ignoring case for search but respecting case for subtitute

Hi I want to make string substitution ignoring case for search but respecting case for subtitute. Ex changing all occurences of "original" in a file to "substitute": original becomes substitute Origninal becomes Substitute ORIGINAL becomes SUBSTITUTE I know this a little special but it's not... (1 Reply)
Discussion started by: kmchen
1 Replies

7. Shell Programming and Scripting

[Solved] Change Upper case to Lower case in C shell

Is there a command that can switch a character variable from UPPER case to lower case? like foreach AC ( ABC BCD PLL QIO) set ac `COMMAND($AC)` ... end Thanks a lot! (3 Replies)
Discussion started by: rockytodd
3 Replies

8. Shell Programming and Scripting

Conversion from Upper Case to Lower Case Condition based

Hello Unix Gurus : It would be really appreciative if can find a solution for this . I have records in a file . I need to Capitalize the records based on condition . For Example i tried the following Command COMMAND --> fgrep "2000YUYU" /export/home/oracle/TST/data.dat | tr '' ''... (12 Replies)
Discussion started by: tsbiju
12 Replies

9. Shell Programming and Scripting

Change first letter of a word from lower case to upper case

Hi all, I am trying to find a way to change first letter in a word from lower case to upper case. It should be done for each first word in text or in paragraph, and also for each word after punctuation like . ; : ! ?I found the following command sed -i 's/\s*./\U&\E/g' $@ filenamebut... (7 Replies)
Discussion started by: georgi58
7 Replies
OpenGuides::Search(3pm) 				User Contributed Perl Documentation				   OpenGuides::Search(3pm)

NAME
OpenGuides::Search - Search form generation and processing for OpenGuides. DESCRIPTION
Does search stuff for OpenGuides. Distributed and installed as part of the OpenGuides project, not intended for independent installation. This documentation is probably only useful to OpenGuides developers. SYNOPSIS
use CGI; use OpenGuides::Config; use OpenGuides::Search; my $config = OpenGuides::Config->new( file => "wiki.conf" ); my $search = OpenGuides::Search->new( config => $config ); my %vars = CGI::Vars(); $search->run( vars => \%vars ); METHODS
new my $config = OpenGuides::Config->new( file => "wiki.conf" ); my $search = OpenGuides::Search->new( config => $config ); wiki my $wiki = $search->wiki; An accessor; returns the underlying Wiki::Toolkit object. config my $config = $search->config; An accessor; returns the underlying OpenGuides::Config object. run my %vars = CGI::Vars(); $search->run( vars => \%vars, return_output => 1, # defaults to 0 return_tt_vars => 1, # defaults to 0 ); The "return_output" parameter is optional. If supplied and true, the stuff that would normally be printed to STDOUT will be returned as a string instead. The "return_tt_vars" parameter is also optional. If supplied and true, the template is not processed and the variables that would have been passed to it are returned as a hash. This parameter takes precedence over "return_output". These two parameters exist to make testing easier; you probably don't want to use them in production. You can also request just the raw search results: my %results = $search->run( os_x => 528864, os_y => 180797, os_dist => 750, format => "raw", ); Results are returned as a hash, keyed on the page name. All results are returned, not just the first "page". The values in the hash are hashes themselves, with the following key/value pairs: o name o wgs84_lat - WGS-84 latitude o wgs84_long - WGS-84 longitude o summary o distance - distance (in metres) from origin, if origin exists o score - relevance to search string, if search string exists; higher score means more relevance In case you're struggling to follow the code, it does the following: 1) Processes the parameters, and bails out if it hit a problem with them 2) If a search string was given, do a text search 3) If distance search paramaters were given, do a distance search 4) If no search has occured, print out the search form 5) If an error occured, bail out 6) If we got a single hit on a string search, redirect to it 7) If no results were found, give an empty search results page 8) Sort the results by either score or distance 9) Decide which results to show, based on paging 10) Display the appropriate page of the results INPUT
word a single word will be matched as-is. For example, a search on escalator will return all pages containing the word "escalator". AND searches A list of words with no punctuation will be ANDed, for example: restaurant vegetarian will return all pages containing both the word "restaurant" and the word "vegetarian". OR searches A list of words separated by commas (and optional spaces) will be ORed, for example: restaurant, cafe will return all pages containing either the word "restaurant" or the word "cafe". phrase searches Enclose phrases in double quotes, for example: "meat pie" will return all pages that contain the exact phrase "meat pie" - not pages that only contain, for example, "apple pie and meat sausage". SEARCHING BY DISTANCE
To perform a distance search, you need to supply one of the following sets of criteria to specify the distance to search within, and the origin (centre) of the search: os_dist, os_x, and os_y Only works if you chose to use British National Grid in wiki.conf osie_dist, osie_x, and osie_y Only works if you chose to use Irish National Grid in wiki.conf latlong_dist, latitude, and longitude Should always work, but has a habit of "finding" things a couple of metres away from themselves. You can perform both pure distance searches and distance searches in combination with text searches. OUTPUT
Results will be put into some form of relevance ordering. These are the rules we have tests for so far (and hence the only rules that can be relied on): o A match on page title will score higher than a match on page category or locale. o A match on page category or locale will score higher than a match on page content. o Two matches in the title beats one match in the title and one in the content. AUTHOR
The OpenGuides Project (openguides-dev@lists.openguides.org) COPYRIGHT
Copyright (C) 2003-2008 The OpenGuides Project. All Rights Reserved. The OpenGuides distribution is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
OpenGuides perl v5.14.2 2013-01-11 OpenGuides::Search(3pm)
All times are GMT -4. The time now is 01:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy