[NTLUG:Discuss] sed question
Eric Schnoebelen
eric at cirr.com
Wed Mar 22 16:39:20 CST 2006
jm writes:
- hopefully someone here has a good background in sed...
I might have a small background in sed.. :D
- the following is a sample line from a csv file i'm trying to
- modify using sed:
-
[...]
- : X MAINT SLOT 6-2 "
-
- that's all one line, in case the mail client breaks it up. i can get
- everything i want done except for removing the last double quote at
- the end of the line.
-
- sed -e 's/"$//g' dig-pull.csv > dig-pull.modified
-
- does not remove the final ". i'm using GNU sed version 4.1.4 on
- mandriva 10.2. is my syntax wrong? is this a bug in this version of
- sed? anything else i should consider?
My first thought would be verifying that there is no
additional white space after the final quote. If there is, the
end of line anchor isn't going to match.
Try
sed -e 's/"[ ]$//' ....
(there's both a space and a tab in the brackets.. You
might also want to include a literal carriage return too.)
Also, you don't really need "g" as an argument, as your
match is only at one place in the line.
--
Eric Schnoebelen eric at cirr.com http://www.cirr.com
"/bin/sh: Bourne in the USA"
More information about the Discuss
mailing list