regexperlmarc

Removing trailing period from a line in MARC data file in Perl


Forgive my n00bosity:

I am looking to do a find and replace on a large file of MARC records. I want to search for all strings starting with newline =586 and then remove the period at the end of the line, keeping the data in between intact.

I have tried quite a few permutations and none of them seemed to work. I feel I am missing something obvious here. Help?!?


Solution

  • Try this

    Search: (^=586.*)\.$
    Replace: \1
    

    I think this would be the command:

    /(^=586.*)\.$/\1/
    

    Note: I don't speak perl, so the syntax might be a little off