ExchangeFileContents
ExchangeFileContents (© 2018-2020 Helmut Jakoby)

Introduction

efc is a simple console program that replaces texts in files. The text to be exchanged can be transferred directly or it is in a file.

efcd [file] [oldcontent] [newcontent] (optional! [targetfile]) [options]

Parameter:

  • file: The source file(s), wildcard ('?' und '*') are allowed. You can pass a filename with both full and relative path.
  • oldcontent: The content to be exchanged.
    When the parameter begins with 'text:' or 't:', then the following text, after 'text:' or 't:' exchanged.
    When the parameter begins with 'hex:' or 'h:', then the following hexadecimal sequence, after 'hex:' or 'h:' exchanged. The hexadecimal sequence consists of two- digit, comma-separated hexadecimal numbers (e.g. 'h:0D,0A').
    If the parameter begins with 'file:' or 'f:', the content to be exchanged is in File whose name is after 'file:' or 'f:'. You can specify a filename with both full and relative path.
  • newcontent: The content to be pasted. Can also be a file name whose contents are taken.
    When the parameter begins with 'text:' or 't:', the original text (the second parameter 'oldcontent') is exchanged for the text following 'text:' or 't:'.
    When the parameter begins with 'hex:' or 'h:', the original text (the second parameter 'oldcontent') is exchanged for the hexadecimal sequence following 'hex:' or 'h:'. The hexadecimal sequence consists of two-digit, comma-separated hexadecimal numbers (e.g. "h:0D,0A").
    If the parameter begins with 'file:' or 'f:', the new content is in the File whose name is after 'file:' or 'f:'. You can specify a filename with both full and relative path.
  • targetfile: Iif the parameter [file] represents a unique name, the resulting content can be saved to a new file. This file will only be overwritten if the parameter '-f' is passed.
  • options:
    • -r The subdirctorys are also searched recursively.
    • -v Indicates wheter an how often the content of the file has been changed.
    • -v+ Also displays the skipped files.
    • -s Stops in case of an error and waits for a keystroke.
    • -f if the parameter [targetfile] is set, an existing target file will only be overwritten if this parameter is passed.
Note
The character '/' is expected as separator in the path specifications!

Example

License

ExchangeFileContents is free software:

GNU Lesser General Public License Usage
You can redistribute the programm and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Please review the following information to ensure the GNU Lesser General Public License version 3 requirements will be met: https://www.gnu.org/licenses/lgpl-3.0.html.

GNU General Public License Usage
Alternatively, you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Please review the following information to ensure the GNU Lesser General Public License version 3 requirements will be met: https://www.gnu.org/licenses/lgpl-3.0.html.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.