Sponsored Content
Top Forums Shell Programming and Scripting Removing uppercase words from textfiles Post 302093066 by frieling on Tuesday 17th of October 2006 07:16:19 AM
Old 10-17-2006
Thankyou: Removing uppercase words from textfiles

Thankyou both for your fast replies.

Yogesh Sawant:
worked like a dream.

ghostdog74:
became --> NameError: name 's' is not defined.
changed it to

lines = re.sub("[A-Z]{2,}",'',lines).replace(" ", " ")
and it also worked like a dream

thankyou again

best regards
frieling
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to replace a string in multiple textfiles?

Hello I'm trying to replace a string in multiple text files using the tcsh shell. For example I've got some files called test1 test2 test3 etc. Each of them contains "Hello World". Now I want to replace each "Hello" with "Howdy" using sed and a foreach loop. I tried the following but it... (1 Reply)
Discussion started by: dwidmer
1 Replies

2. Shell Programming and Scripting

removing 2 words from file.

Hi All, I have a text file with name of source files in that. source files ends with .mxml and .css. Now I want to remove the extensions of these source files. Currently I can do so by writing 2 sed commands, as there are files with just 2 different extensions. But I want to do it in one sed... (6 Replies)
Discussion started by: mkashif
6 Replies

3. Shell Programming and Scripting

Searching for lines in textfiles

Hello all, I've a problem. I've two logfiles and i need to find lines in the second file by using information from the first file. First I need to extract a searchpattern from the first file. Its like abc=searchpattern&cde=. All between abc= and &cde= is the pattern I need to find in the second... (2 Replies)
Discussion started by: Avarion
2 Replies

4. Shell Programming and Scripting

Removing identical words in column

I have a file that needs to be cleaned up. Here is the file: Project Project John Project Gary Project Sean Project2 Project2 Lisa Project2 Tyler Project2 Sam Project3 Project3 Mike Project3 Bran I need the o/p to be: Project John Gary Sean Project2 (7 Replies)
Discussion started by: leepet01
7 Replies

5. Shell Programming and Scripting

finding and removing 2 identical consecutive words in a text

i want to write a shell script that correct a text file.for example if i have the input file: "john has has 2 apples anne has 3 oranges oranges" i want that the output file be like this: "john has 2 apples anne has 3 oranges" i've tried to read line by line from input text file into array... (11 Replies)
Discussion started by: cocostaec
11 Replies

6. Shell Programming and Scripting

Conditional removing of words from a line

Hi , I have a .csv file,from which I want to remove some data from each column as below. Source Data GT_12_AUDIT,SCHEDULED,NOZOMI2010/GT_12_AUDIT,CTSCAN/Zh_GT_6547887/GT_12_AUDIT,CTSCAN/Zh_GT_6547887... (3 Replies)
Discussion started by: gaur.deepti
3 Replies

7. Shell Programming and Scripting

removing the words with symbols in a file in unix

I have file like below Hi iam author <br>joseph</br> in france. I live in my home <br></br> but no food. I will play footbal <br></br> but i wont play cricket. I will read all the books <br>all fiction stories</br> i hate horror stories. I want output like below Hi iam author... (3 Replies)
Discussion started by: vinothsekark
3 Replies

8. Shell Programming and Scripting

Get group of consecutive uppercase words using gawk

Hi I'd like to extract, from a text file, the strings starting with "The Thing" and only composed of words with a capital first letter and apostrophes, like for example: "The Thing I Only" from "those are the The Thing I Only go for whatever." or "The Thing That Are Like Men's Eyewear" ... (7 Replies)
Discussion started by: louisJ
7 Replies

9. Shell Programming and Scripting

Gawk gensub, match capital words and lowercase words

Hi I have strings like these : Vengeance mitt Men Vengeance gloves Women Quatro Windstopper Etip gloves Quatro Windstopper Etip gloves Girls Thermobite hooded jacket Thermobite Triclimate snow jacket Boys Thermobite Triclimate snow jacket and I would like to get the lower case words at... (2 Replies)
Discussion started by: louisJ
2 Replies

10. Shell Programming and Scripting

Add words in beginning , end after removing a word in a file

My file has the entries like below... /dev/sds /dev/sdak /dev/sdbc /dev/sdbu I want to make the file like below echo 1 > /sys/block/sds/device/rescan echo 1 > /sys/block/sdak/device/rescan echo 1 > /sys/block/sdbc/device/rescan echo 1 > /sys/block/sdbu/device/rescan (2 Replies)
Discussion started by: saravanapandi
2 Replies
ISPELLAFF2MYSPELL(1)					User Contributed Perl Documentation				      ISPELLAFF2MYSPELL(1)

NAME
ispellaff2myspell - A program to convert ispell affix tables to myspell format. SYNOPSIS
ispellaff2myspell [options] <affixfile> --myheader your_header Options: --affixfile=s Affix file --bylocale Use current locale setup for upper/lowercase conversion --charset=s Use specified charset for upper/lowercase conversion (defaults to latin1) --debug Print debugging info --extraflags=s Allow some non alphabetic flags --lowercase=s Lowercase string --myheader=s Header file --printcomments Print commented lines in output --replacements=s Replacements file --split=i Split flags with more that i entries --uppercase=s Uppercase string DESCRIPTION
ispellaff2myspell is a script that will convert ispell affix tables to myspell format in a more or less successful way. This script does not create the dict file. Something like ( echo `cat mydict.words+ | wc -l`; cat mydict.words+ ) > mydict.dict should do the work, with mydict.words+ being the munched wordlist OPTIONS
--affixfile=s Affix file. You can put it directly in the command line. --bylocale Use current locale setup for upper/lowercase conversion. Make sure that the selected locale match the dictionary one, or you might get into trouble. --charset=s Use specified charset for upper/lowercase conversion (defaults to latin1). Currently allowed values for charset are: latin0, latin1, latin2, latin3. --debug Print some debugging info. --extraflags:s Allows some non alphabetic flags. When invoked with no value the supported flags are currently those corresponding to chars represented with the escape char as first char. will be stripped. When given with the flag prefix will allow that flag and strip the given prefix. Be careful when giving the prefix to properly escape chars, e.g. you will need -e "\\" or -e '\' for flags like [ to be stripped to [. Otherwise you might even get errors. Use -e "^" to allow all flags and pass them unmodified. You will need a call to -e for each flag type, e.g., -e "\\" -e "~\\" (or -e '\' -e '~\'). When a prefix is explicitely set, the default value (anything starting by ) is disabled and you need to enable it explicitely as in previous example. --lowercase=s Lowercase string. Manually set the string of lowercase chars. This requires --uppercase having exactly that string but uppercase. --myheader=s Header file. The myspell aff header. You need to write it manually. This can contain everything you want to be before the affix table --printcomments Print commented lines in output. --replacements=file Add a pre-defined replacements table taken from 'file' to the .aff file. Will skip lines not beginning with REP, and set the replacements number appropriately. --split=i Split flags with more that i entries. This can be of interest for flags having a lot of entries. Will split the flag in chunks containing i entries. --uppercase=s Uppercase string. Manually set the sring of uppercase chars. This requires --lowercase having exactly that string but lowercase. If your encoding is currently unsupported you can send me a file with the two strings of lower and uppercase chars. Note that they must match exactly but case changed. It will look something like $lowercase='a-zaaaa~aeaaaeceeeeeiiiie`n~oooo~oeouuuueyp'; $uppercase='A-ZAAAA~AeAaCEEEEeIIIIe-N~OOOO~OeOUUUUeYP'; SEE ALSO
The OpenOffice.org Lingucomponent Project home page <http://lingucomponent.openoffice.org/index.html> and the document <http://lingucomponent.openoffice.org/affix.readme> that provides information about the basics of the myspell affix file format. You can also take a look at /usr/share/doc/libmyspell-dev/affix.readme.gz /usr/share/doc/libmyspell-dev/README.compoundwords /usr/share/doc/libmyspell-dev/README.replacetable in your Debian system. AUTHORS
Agustin Martin <agustin.martin@hispalinux.es> perl v5.10.1 2010-08-24 ISPELLAFF2MYSPELL(1)
All times are GMT -4. The time now is 12:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy