Delete <br /> from a txt file

Discussion in 'Mac Programming' started by vloryan, Aug 12, 2014.

  1. vloryan macrumors member

    Joined:
    Jan 11, 2014
    #1
    How can i delete
    Code:
    <br />
    from a txt file using Applescript or shell script?

    thanks!
     
  2. chrfr macrumors 603

    Joined:
    Jul 11, 2009
    #2
    Do you have only one file or many?
     
  3. vloryan thread starter macrumors member

    Joined:
    Jan 11, 2014
    #3
    At least 7 files per folder. Files shall be edited and overwritten.
     
  4. briloronmacrumo macrumors 6502

    briloronmacrumo

    Joined:
    Jan 25, 2008
    Location:
    USA
    #4
    TextWrangler

    TextWrangler provides powerful multi-file search and replace ( including grep if needed ) and might prove more effective and less technically challenging than a script. Rich Siegel and the great developers at Bare Bones are somehow able to offer this awesome tool at no charge. Anyway, just a thought since, on the surface, your editing needs appear basic. I have no affiliation with Bare Bones or the product. Just a happy user.
     
  5. JustMartin macrumors 6502a

    Joined:
    Feb 28, 2012
    Location:
    UK
    #5
    If you wanted to do it a a shell script, you could iterate through the files and run sed on them

    It would look something like this

    Code:
    for each filename in /myDirectory do
      sed -n -e '/<br \/>/d' filename
    end for
    
    But, as a warning. I have not tested this code, this is simply an approach that you can start from. Try googling 'loop through files with bash' and 'sed guides'. I strongly advise that you start working this stuff out for yourself. I don't think the kind of spoon feeding you're getting here is in your best interests.
     

Share This Page