Well, assuming the asker wants an answer written in Perl (this isn't unixmonks.org or shellscriptmonks.org) I'll give it a shot.
The given code and the description don't seem to match.
A one liner for the ACTUAL CODE GIVEN (i.e. will remove every occurance of } in the file):
perl -i.old -pe 's/}//g;' memgrp.dat
If you just want to remove } when it occurs at the end of the line, just change the regexp to something like
s/}(\s*)$/$1/g
You might need to use double quotes on windows.
This will overwrite memgrp.dat with the new information, backing the old one up in memgrp.dat.old (see
perlman:perlrun.) This may not be exactly what you want, but it's easy to massage so you get what you're looking for.
This code has been lightly tested and "it works for me."
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.