Complete.Org: Mailing Lists: Archives: linux-help: March 2003:
[linux-help] Re: Regular expression with grep
Home

[linux-help] Re: Regular expression with grep

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "'linux-help@xxxxxxxxx'" <linux-help@xxxxxxxxx>
Subject: [linux-help] Re: Regular expression with grep
From: "Wilner, Alden" <awilner@xxxxxxxx>
Date: Wed, 26 Mar 2003 17:15:25 -0600
Reply-to: linux-help@xxxxxxxxx

Have you tried "sed s/.$//" ?
Since every line has EITHER an extra space OR an extra CR character, you can
just use the wildcard.
Obviously if some lines just have a word with a LF following it, this will
not work. Then you would want to consider something
like "s/[a-zA-z]$/&!/" to add a character to the lines that don't already
have one.
-----Original Message-----
From: bruce [mailto:bbales@xxxxxxx]
Sent: Tuesday, March 25, 2003 9:56 PM
To: linux-help@xxxxxxxxx
Subject: [linux-help] Regular expression with grep


I have a large file which is a concatination and sort of two files, one 
from msdos and the other from linux.  Each line is a single word.  grep 
doesn't work as I expected on this file.  Examination revealed some 
lines end with "(space)LF" and some end with "CR/LF".  

I want to eliminate the CR and the space.  I tried
cat foo |sed s/\x0d\x0a/\x0a/ and it didn't do anything.  A test run of 
cat foo |grep \x0d finds nothing.  Neither does 
cat foo |grep \x61.  cat foo |grep a finds lots of words with an "a" in 
them.

I tried many combinations of quotes, parentheses, braces, brackets, 
single quotes and nothing works with grep or sed.

Several books and a search of the web didn't turn up anything useful.  
Any help?
bruce
-- This is the linux-help@xxxxxxxxx list.  To unsubscribe,
visit http://www.complete.org/cgi-bin/listargate-aclug.cgi


-- This is the linux-help@xxxxxxxxx list.  To unsubscribe,
visit http://www.complete.org/cgi-bin/listargate-aclug.cgi


[Prev in Thread] Current Thread [Next in Thread]