[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: filtering of text files



On Thu, May 06, 1999 at 12:12:37PM +0000, Richard Harran wrote:
> I need to filter some text files to convert all the letters to the same
> case, and to remove punctuation.  I guess I should use 'sed', but the
> man page is disfunct, and I'm struggling with the info.  Could someone
> give me a hint (particularly for the case change thing).

I read the message which suggested awk; with all due respect, I think
tr is more appropriate to this case.  Try something like this:

cat filename | tr '[:lower:][:punct:]' '[:upper:]' > filename2

Of course, to go from uppercase to lowercase, switch the upper and
lower in the command above.

Roughly, tr just translates from one set to another.  lower maps to
upper well, and punct maps punctuation to the nothingness at the end
of the second string, thereby removing it.

-- 
Ian Peters		"I never let schooling interfere with my education."
itp@gnu.org					-- Mark Twain


Reply to: