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 302652787 by new_item on Thursday 7th of June 2012 05:53:52 PM
Old 06-07-2012
Code:
$ cat | sed 's/\./\.\n/g' | tr '[:upper:]' '[:lower:]' | sed 's/^ *//g' | perl -wp -pe '$_ = ucfirst' | tr '\n' ' '

Code:
cat | tr '[:upper:]' '[:lower:]' | sed -e 's/\./\.\n/g'  | sed -e 's/^ *//g' | sed -e 's/\(^[a-z]\)\([a-zA-Z0-9]*\)/\u\1\2/g' | tr '\n' ' '

AN UPPER RIDGE EXTENDS OVER THE W CARIBBEAN WITH THE AXIS FROM OVER CENTRAL AMERICA THROUGH THE GULF OF HONDURAS ACROSS W CUBA INTO THE W ATLC. A SECOND UPPER RIDGE EXTENDS FROM THE W TROPICAL ATLC OVER THE LESSER ANTILLES INDUCING AN INVERTED UPPER TROUGH OVER THE CARIBBEAN EXTENDING FROM THE MONA PASSAGE TO OVER COLOMBIA.
An upper ridge extends over the w caribbean with the axis from over central america through the gulf of honduras across w cuba into the w atlc. A second upper ridge extends from the w tropical atlc over the lesser antilles inducing an inverted upper trough over the caribbean extending from the mona passage to over colombia.

Code:
cat | tr '[:upper:]' '[:lower:]' | awk 'BEGIN {RS="."; ORS=". "} { {sub(".", substr(toupper($1),1,1) , $1)} print }'

AN UPPER RIDGE EXTENDS OVER THE W CARIBBEAN WITH THE AXIS FROM OVER CENTRAL AMERICA THROUGH THE GULF OF HONDURAS ACROSS W CUBA INTO THE W ATLC. A SECOND UPPER RIDGE EXTENDS FROM THE W TROPICAL ATLC OVER THE LESSER ANTILLES INDUCING AN INVERTED UPPER TROUGH OVER THE CARIBBEAN EXTENDING FROM THE MONA PASSAGE TO OVER COLOMBIA.

An upper ridge extends over the w caribbean with the axis from over central america through the gulf of honduras across w cuba into the w atlc. A second upper ridge extends from the w tropical atlc over the lesser antilles inducing an inverted upper trough over the caribbean extending from the mona passage to over colombia. .

Last edited by new_item; 06-07-2012 at 07:55 PM..
 

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
ZLAGS2(l)								 )								 ZLAGS2(l)

NAME
ZLAGS2 - compute 2-by-2 unitary matrices U, V and Q, such that if ( UPPER ) then U'*A*Q = U'*( A1 A2 )*Q = ( x 0 ) ( 0 A3 ) ( x x ) and V'*B*Q = V'*( B1 B2 )*Q = ( x 0 ) ( 0 B3 ) ( x x ) or if ( .NOT.UPPER ) then U'*A*Q = U'*( A1 0 )*Q = ( x x ) ( A2 A3 ) ( 0 x ) and V'*B*Q = V'*( B1 0 )*Q = ( x x ) ( B2 B3 ) ( 0 x ) where U = ( CSU SNU ), V = ( CSV SNV ), SYNOPSIS
SUBROUTINE ZLAGS2( UPPER, A1, A2, A3, B1, B2, B3, CSU, SNU, CSV, SNV, CSQ, SNQ ) LOGICAL UPPER DOUBLE PRECISION A1, A3, B1, B3, CSQ, CSU, CSV COMPLEX*16 A2, B2, SNQ, SNU, SNV PURPOSE
ZLAGS2 computes 2-by-2 unitary matrices U, V and Q, such that if ( UPPER ) then U'*A*Q = U'*( A1 A2 )*Q = ( x 0 ) ( 0 A3 ) ( x x ) and V'*B*Q = V'*( B1 B2 )*Q = ( x 0 ) ( 0 B3 ) ( x x ) or if ( .NOT.UPPER ) then U'*A*Q = U'*( A1 0 )*Q = ( x x ) ( A2 A3 ) ( 0 x ) and V'*B*Q = V'*( B1 0 )*Q = ( x x ) ( B2 B3 ) ( 0 x ) where U = ( CSU SNU ), V = ( CSV SNV ), ( -CONJG(SNU) CSU ) ( -CONJG(SNV) CSV ) Q = ( CSQ SNQ ) ( -CONJG(SNQ) CSQ ) Z' denotes the conjugate transpose of Z. The rows of the transformed A and B are parallel. Moreover, if the input 2-by-2 matrix A is not zero, then the transformed (1,1) entry of A is not zero. If the input matrices A and B are both not zero, then the transformed (2,2) element of B is not zero, except when the first rows of input A and B are parallel and the second rows are zero. ARGUMENTS
UPPER (input) LOGICAL = .TRUE.: the input matrices A and B are upper triangular. = .FALSE.: the input matrices A and B are lower triangular. A1 (input) DOUBLE PRECISION A2 (input) COMPLEX*16 A3 (input) DOUBLE PRECISION On entry, A1, A2 and A3 are elements of the input 2-by-2 upper (lower) triangular matrix A. B1 (input) DOUBLE PRECISION B2 (input) COMPLEX*16 B3 (input) DOUBLE PRECISION On entry, B1, B2 and B3 are elements of the input 2-by-2 upper (lower) triangular matrix B. CSU (output) DOUBLE PRECISION SNU (output) COMPLEX*16 The desired unitary matrix U. CSV (output) DOUBLE PRECISION SNV (output) COMPLEX*16 The desired unitary matrix V. CSQ (output) DOUBLE PRECISION SNQ (output) COMPLEX*16 The desired unitary matrix Q. LAPACK version 3.0 15 June 2000 ZLAGS2(l)
All times are GMT -4. The time now is 10:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy