[NTLUG:Discuss] sed question
jm
jm5379 at gmail.com
Wed Mar 22 16:48:51 CST 2006
thanks. i realized after i sent the email and played around a bit
that i didn't need the g. also, i had verified earlier the " is the
last character; it's a csv file automatically created, so the chance
of it being malformed is small.
as a last option, i tried the script once i got home with a more
recent version of mandriva and a (presumably) different version of sed
(though it also shows 4.1.4) - and it does as expected, so i'm
assuming the other version is corrupt. i'm mailing myself the working
copy to see if it works at work.
thanks for the reply and the suggestions.
On 3/22/06, Eric Schnoebelen <eric at cirr.com> wrote:
>
> 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"
>
> _______________________________________________
> http://ntlug.pmichaud.com/mailman/listinfo/discuss
>
--
since this is a gmail account, please verify the mailing list is
included in the reply to addresses
More information about the Discuss
mailing list