Loading ...
Sorry, an error occurred while loading the content.

[jasspa] Re: Command-line multiple files global-search and replace

Expand Messages
  • Steven Phillips,,,
    Suggest you look at printall.emf or dos2unix.emf which do this.SteveSubject: [jasspa] Me: Command-line multiple files global-search and replace From:
    Message 1 of 2 , Oct 4, 1999
    • 0 Attachment
      Suggest you look at printall.emf or dos2unix.emf which do this.

      Steve

      > Subject: [jasspa] Me: Command-line multiple files global-search and replace
      > From: Detlef Groth <dgroth@...>
      > Date: Mon, 04 Oct 1999 13:33:14 +0200
      > To: jasspa@egroups.com
      >
      > Recently I was discovering more and more the command-line use of Me which is
      > very great.
      >
      > The command:
      > me32 -p "@..." <einleit.tex >einleit.out
      >
      > with replace.emf:
      > ;; beginn replace.emf
      > define-macro start-up
      > ; german keyboard configuration
      > translate-key "A-C-7 A-C-{" "\x7b"
      > translate-key "A-C-9 A-C-]" "\x5d"
      > translate-key "A-C-0 A-C-}" "\x7d"
      > translate-key "A-C-[ A-C-\\" "\x5c"
      > translate-key "A-C-= A-C-~" "\x7e"
      > translate-key "A-C-m A-C-\xb5" "\xb5"
      > translate-key "A-C-8 A-C-[" "\x5b"
      > translate-key "A-C-q A-C-@" "\x40"
      > translate-key "A-C-2 A-C-�" "\xb2"
      > translate-key "A-C-b A-C-|" "\x7c"
      > ; end german keyboard
      > find-buffer "*stdin*"
      > ; translations german umlauts to tex
      > beginning-of-buffer
      > replace-string "�" "\\\\\"a" ; conversion � -> \"a
      > beginning-of-buffer
      > replace-string "�" "\\\\\"o"
      > beginning-of-buffer
      > replace-string "�" "\\\\\"u"
      > beginning-of-buffer
      > replace-string "�" "\\\\\"A"
      > beginning-of-buffer
      > replace-string "�" "\\\\\"O"
      > beginning-of-buffer
      > replace-string "�" "\\\\\"�"
      > beginning-of-buffer
      > replace-string "�" "{\\\\\"s}"
      > save-buffer
      > quick-exit
      > !emacro
      > ;; end of file
      >
      > did some german to tex format translations. However no file-wildcards like
      > '*.tex' are allowed here. How to process all texfiles in one directory with on
      > single command?
      >
      > Thanks,
      >
      > Detlef
      >
      > ------------------------------------------------------------------------
      > __________________________________________________________________________
      >
      > This is an unmoderated list. JASSPA is not responsible for the content of
      > any material posted to this list.
      >
      >
      >
      >
      >
    • Detlef Groth
      ... This was a good tip: I was generating: ; German to LaTex text file convertion routine. Run: ; me @ger2tex ; converts also other symbols to
      Message 2 of 2 , Oct 5, 1999
      • 0 Attachment
        At 12:49 04.10.99 +0100, you wrote:
        >
        >Suggest you look at printall.emf or dos2unix.emf which do this.
        >
        >Steve
        >
        This was a good tip:

        I was generating:

        ; German to LaTex text file convertion routine. Run:
        ; me "@ger2tex" <files>
        ; converts also other symbols to proper tex
        ;
        ; Author : Detlef Groth
        ; Last Modified : <04.10.99 15.00>
        ;
        define-macro start-up
        delete-other-windows
        ; german keyboard configuration
        translate-key "A-C-7 A-C-{" "\x7b"
        translate-key "A-C-9 A-C-]" "\x5d"
        translate-key "A-C-0 A-C-}" "\x7d"
        translate-key "A-C-[ A-C-\\" "\x5c"
        translate-key "A-C-= A-C-~" "\x7e"
        translate-key "A-C-m A-C-\xb5" "\xb5"
        translate-key "A-C-8 A-C-[" "\x5b"
        translate-key "A-C-q A-C-@" "\x40"
        translate-key "A-C-2 A-C-²" "\xb2"
        translate-key "A-C-b A-C-|" "\x7c"
        ; end german keyboard
        !while ¬ &seq $buffer-bname "*scratch*"
        ml-write &spr "Processing [%s]" $buffer-fname
        beginning-of-buffer
        replace-string "ä" "\"a" ; conversion ä -> \"a ff
        beginning-of-buffer
        replace-string "ö" "\"o"
        beginning-of-buffer
        replace-string "ü" "\"u"
        beginning-of-buffer
        replace-string "Ä" "\"A"
        beginning-of-buffer
        replace-string "Ö" "\"O"
        beginning-of-buffer
        replace-string "Ü" "\"U"
        beginning-of-buffer
        replace-string "ß" "\"s"
        beginning-of-buffer
        replace-string "µ" "\$\\\\mu\$"
        beginning-of-buffer
        replace-string "°" "\$\^\\\\circ\$"
        beginning-of-buffer
        replace-string "±" "\$\\\\pm\$"
        save-buffer
        delete-buffer $buffer-bname
        !done
        exit-emacs
        !emacro
        ;;; end of file

        which can process many files at one time.

        >What do you think about using perl - it is much easier to automate
        >translations.
        >s/ä/\"a/g i.e. sed syntax s
        >tr/from/to tr syntax
        >
        >Arne
        >
        Of course it is easier using texttools like awk, perl, tr or gsar, but for many users it is difficult to learn perl or awk. So it would be fine, if Me could do this inside a batch file, requiring only one program to write and to process.

        However the Me32.exe does not work properly inside batches here, because the batch is continuing during the translations. So you have to use the dos-exe me.exe inside a batch here.

        Best regards, Detlef
      Your message has been successfully submitted and would be delivered to recipients shortly.