using grep and to remove all word with uppercase


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers using grep and to remove all word with uppercase
# 1  
Old 09-29-2008
using grep and to remove all word with uppercase

I try to write a small script that looks in the file tt for all the words that start with m in lowercase and in which there is no uppercase.

#!/bin/sh
grep ^m\.*\.[^A-Z]\.* tt
# 2  
Old 09-29-2008
To find individual words, you need to put all of the owrds into a single column first:
Code:
tr -s ' ' '\n' < file

Next look for words starting with m and with all lower case letters
Pipe the above command into your grep statement, and work from there.
# 3  
Old 09-30-2008
I still have a problem

I still have a problem with my script.
I have the following file tt

m.cc
mA.c.*.l
mm.
mmmmAZETY
moreAs
mriouzoepi.dfgr

and I would like that only
m.cc
mm.
mriouzoepi.dfgr

are printed on the screen. If someone have an idea, then thank you for your help.
# 4  
Old 09-30-2008
To exclude all lines which don't start with lowercase m or which contain uppercase, try

Code:
grep '^m[^A-Z]*$' file

or perhaps

Code:
egrep -v '^m|[A-Z]' file

If I guessed wrong what your criteria are, perhaps you can formulate them here so we don't have to continue to guess.
# 5  
Old 10-01-2008
thank you

thank to your help I could solve my problem
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep for a word or word with underscore

I have a file "test" with following contents: cat test abc abcd_efg abc_abc I want to only grep for abc or abc_ without getting other results, how do I achieve this? If I use grep -w abc test option I get only abc and not abc_. If I use egrep "abc|abc_" test its still printing... (3 Replies)
Discussion started by: ctrld
3 Replies

2. Shell Programming and Scripting

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... (5 Replies)
Discussion started by: dockline
5 Replies

3. Shell Programming and Scripting

How ti Grep for a word and print the next word

Hi can we grep for a word and print the next word of the greped word? ex:- create or replace function function_name create function function_name we should search for word "function" and output next word "function_name" from both lines. (3 Replies)
Discussion started by: manasa_vs
3 Replies

4. 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

5. Shell Programming and Scripting

grep part of word or Another word from a string

Hi all, FileOne family balance >>>>> 0 0 0 0 java.io.FileNotFoundException: Settings.xml (No such file or directory) at java.io.FileInputStream.open(Native Method) .. .... ..... ..... java.lang.NullPointerException ... ..... ...... Stacktrace: at... (2 Replies)
Discussion started by: linuxadmin
2 Replies

6. Shell Programming and Scripting

Grep out specific word and only that word

ok, so this is proving to be kind of difficult even though it should not be. say for instance I want to grep out ONLY the word fkafal from the below output, how do I do it? echo ajfjf fjfjf iafjga fkafal foeref afoafahfia | grep -w "fkafal" If i run the above command, i get back all the... (4 Replies)
Discussion started by: SkySmart
4 Replies

7. Shell Programming and Scripting

Uppercase word in PERL

how do i print uppercase words in a string in PERL For example $str=" welcome to UNIX programming" should print UNIX $str="WELCOME to unix programming" should print WELCOME i itried the following /\s+\w+\b/ $str Can u help me in to get a uppercase word in PERL (3 Replies)
Discussion started by: vkca
3 Replies

8. Shell Programming and Scripting

GREP a directory to check for uppercase

Hello All, I am trying to write a script to search in my current directory to look for all files that end with HTML and look for any HTML tags that are in upper case. for example if I were to grep test.html and test.html has a tag <P> instead of <p> then it would print the file name. This is... (11 Replies)
Discussion started by: rawmaterial
11 Replies

9. UNIX for Dummies Questions & Answers

how to grep the word and display only the second word from it

hi, consider the below line in a text file, 'Y',getdate(),'N','V',NULL ..... 'N',getdate(),'Y','D',NULL ..... 'Y','N','Y',getdate(),'Y','D',NULL .... as u see above, i want only the second word after the getdate() word... getdate() will not come 2nd word alwys it may be any position but i... (11 Replies)
Discussion started by: prsam
11 Replies

10. UNIX for Dummies Questions & Answers

how to grep for a word and display only the word

Hi, When we "grep" for a word in a file, it returns the lines containing the word that we searched for. Is there a way to display only the words and not the entire line containing them. Thanks Ananth (6 Replies)
Discussion started by: ananthmm
6 Replies
Login or Register to Ask a Question