Sponsored Content
Top Forums Shell Programming and Scripting SED (or other) upper to lowercase, with first letter of first word in each sentence uppercase Post 302652743 by dockline on Thursday 7th of June 2012 04:25:03 PM
Old 06-07-2012
SED (or other) upper to lowercase, with first letter of first word in each sentence uppercase

The title pretty much defines the problem. I have text files that are all in caps. I would like to convert them to lowercase, but have the first letter of the first word in each sentence in uppercase.

I already have SED on the server for fixing / tweaking text files, but I'm open to other solutions.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

uppercase to lowercase

Greetings & Happy New Years To All! A client of mine FTP'ed their files up to the server and it all ended up being in UPPERCASE when it all should be in lowercase. Is there a builtin command or a script anyone knows of that will automagically convert all files to lowercase? Please advise asap... (4 Replies)
Discussion started by: webex
4 Replies

2. AIX

Lowercase to Uppercase

Inside a script I have 2 variables COMP=cy and PT=t. further down the same script I require at the same line to call those 2 variables the first time uppercase and after lowercase ${COMP}${PT}ACE,${COMP}${PT}ace. Can somebody help me Thanks in advance George Govotsis (7 Replies)
Discussion started by: ggovotsis
7 Replies

3. UNIX for Dummies Questions & Answers

uppercase to lowercase

i have no variable and no file i just want to convert AJIT to ajit with some command in UNIX can anybody help (4 Replies)
Discussion started by: ajit.yadav83
4 Replies

4. Shell Programming and Scripting

sed help to convert from lowercase to uppercase and vice versa!

Hello, can sed be used to convert all letters of a file from uppercase to lowercase and vice versa?i know tr command can be used but with sed is it possible? i came up with this :- sed 'y///' file1 actually the above command is also not working! Please help me. Thanks in advance :) (6 Replies)
Discussion started by: salman4u
6 Replies

5. UNIX Desktop Questions & Answers

Unix: lowercase to uppercase

I just started to learn unix... and i needed to make a basic script. i need to 1. read a file (.txt) 2. count the words of EVERY sentece 3. sentences with odd number of words need to be converted into lowercase sentences with even number of words need to be converted into uppercase ... (6 Replies)
Discussion started by: chilli1988
6 Replies

6. UNIX for Dummies Questions & Answers

UPPERCASE to lowercase

Hi All, i have a file and i want to convert all uppercase letters to lowercase letters which are in my file. how can i do this. Thanx (3 Replies)
Discussion started by: temhem
3 Replies

7. Shell Programming and Scripting

Convert to upper case first letter of each word in column 2

Hi guys, I have a file separated by ",". I´m trying to change to upper case the first letter of each word in column 2 to establish a standard format on this column. I hope somebody could help me to complete the SED or AWK script below. The file looks like this: (Some lines in column 2... (16 Replies)
Discussion started by: cgkmal
16 Replies

8. Shell Programming and Scripting

making the first character of word using uppercase using awk and sed

I want to make the first character of some words to be uppercase. I have a file like the one below. uid,givenname,sn,cn,mail,telephonenumber mattj,matt,johnson,matt johnson,mattj@gmail.com markv,mark,vennet,matt s vennet,markv@gmail.com mikea,mike,austi,mike austin,mike@gmail.com I want... (3 Replies)
Discussion started by: matt12
3 Replies

9. Shell Programming and Scripting

Uppercase to lowercase

Hello, I have a list of files in a directory whose names are all in uppercasse, including the file format for eg *.MP3 . I would like to convert these to the normal way we write it ie ABC.MP3 to be converted to Abc.mp3 . I know that this can be done manually by using a lot of "mv" or rename... (6 Replies)
Discussion started by: ajayram
6 Replies

10. 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
btparse::doc::bt_misc(3)					      btparse						  btparse::doc::bt_misc(3)

NAME
bt_misc - miscellaneous BibTeX-like string-processing utilities SYNOPSIS
void bt_purify_string (char * string, btshort options); void bt_change_case (char transform, char * string, btshort options); DESCRIPTION
bt_purify_string() void bt_purify_string (char * string, btshort options); "Purifies" a "string" in the BibTeX way (usually used for generating sort keys). "string" is modified in-place. "options" is currently unused; just set it to zero for future compatibility. Purification consists of copying alphanumeric characters, converting hyphens and ties to space, copying spaces, and skipping (almost) everything else. "Almost" because "special characters" (used for accented and non-English letters) are handled specially. Recall that a BibTeX special character is any brace-group that starts at brace-depth zero whose first character is a backslash. For instance, the string {foo bar}Herr M"uller went from {P{ r}erov} to {AA}rhus contains two special characters: "{foo bar}" and "AA". Neither the ""u" nor the " r" are special characters, because they are not at the right brace depth. Special characters are handled as follows: if the control sequence (the TeX command that follows the backslash) is recognized as one of LaTeX's "foreign letters" ("oe", "ae", "o", "l", "ae", "ss", plus uppercase versions), then it is converted to a reasonable English approximation by stripping the backslash and converting the second character (if any) to lowercase; thus, "{AA}" in the above example would become simply "Aa". All other control sequences in a special character are stripped, as are all non-alphabetic characters. For example the above string, after "purification," becomes barHerr Muller went from Pr rerov to Aarhus Obviously, something has gone wrong with the word "P{ r}erov" (a town in the Czech Republic). The accented `r' should be a special character, starting at brace-depth zero. If the original string were instead {foo bar}Herr M"uller went from P{ r}erov to {AA}rhus then the purified result would be more sensible: barHerr Muller went from Prerov to Aarhus Note the use of a "nonsense" special character "{foo bar}": this trick is often used to put certain text in a string solely for generating sort keys; the text is then ignored when the document is processed by TeX (as long as "foo" is defined as a no-op TeX macro). This assumes, of course, that the output is eventually processed by TeX; if not, then this trick will backfire on you. Also, "bt_purify_string()" is adequate for generating sort keys when you want to sort according to English-language conventions. To follow the conventions of other languages, though, a more sophisticated approach will be needed; hopefully, future versions of btparse will address this deficiency. bt_change_case() void bt_change_case (char transform, char * string, btshort options); Converts a string to lowercase, uppercase, or "non-book title capitalization", with special attention paid to BibTeX special characters and other brace-groups. The form of conversion is selected by the single character "transform": 'u' to convert to uppercase, 'l' for lowercase, and 't' for "title capitalization". "string" is modified in-place, and "options" is currently unused; set it to zero for future compatibility. Lowercase and uppercase conversion are obvious, with the proviso that text in braces is treated differently (explained below). Title capitalization simply means that everything is converted to lowercase, except the first letter of the first word, and words immediately following a colon or sentence-ending punctuation. For instance, Flying Squirrels: Their Peculiar Habits. Part One would be converted to Flying squirrels: Their peculiar habits. Part one Text within braces is handled as follows. First, in a "special character" (see above for definition), control sequences that constitute one of LaTeX's non-English letters are converted appropriately---e.g., when converting to lowercase, "AE" becomes "ae"). Any other control sequence in a special character (including accents) is preserved, and all text in a special character, regardless of depth and punctuation, is converted to lowercase or uppercase. (For "title capitalization," all text in a special character is converted to lowercase.) Brace groups that are not special characters are left completely untouched: neither text nor control sequences within non-special character braces are touched. For example, the string A Guide to LaTeXe: Document Preparation ... would, when "transform" is 't' (title capitalization), be converted to A guide to latexe: Document preparation ... which is probably not the desired result. A better attempt is A Guide to {LaTeXe}: Document Preparation ... which becomes A guide to {LaTeXe}: Document preparation ... However, if you go back and re-read the description of "bt_purify_string()", you'll discover that "{LaTeXe}" here is a special character, but not a non-English letter: thus, the control sequence is stripped. Thus, a sort key generated from this title would be A Guide to Document Preparation ...oops! The right solution (and this applies to any title with a TeX command that becomes actual text) is to bury the control sequence at brace-depth two: A Guide to {{LaTeXe}}: Document Preparation ... SEE ALSO
btparse AUTHOR
Greg Ward <gward@python.net> btparse, version 0.63 2012-05-12 btparse::doc::bt_misc(3)
All times are GMT -4. The time now is 05:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy