sr  1.0.0-src
About: sreplace is a command line tool to replace recursively strings in files.
  Fossies Dox: sr-1.0.0-src.tgz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

sr Documentation

Some Fossies usage hints in advance:

  1. To see the Doxygen generated documentation please click on one of the items in the steelblue colored "quick index" bar above or use the side panel at the left which displays a hierarchical tree-like index structure and is adjustable in width.
  2. If you want to search for something by keyword rather than browse for it you can use the client side search facility (using Javascript and DHTML) that provides live searching, i.e. the search results are presented and adapted as you type in the Search input field at the top right.
  3. Doxygen doesn't incorporate all member files but just a definable subset (basically the main project source code files that are written in a supported language). So to search and browse all member files you may visit the Fossies
  4. sr-1.0.0-src.tgz contents page and use the Fossies standard member browsing features (also with source code highlighting and additionally with optional code folding).
readme.md

DESCRIPTION

sreplace is command line tool to replace strings in the specified files.

Features:

  • Fast replacement and handle huge files.
  • Replaces recursively in folders.
  • Accepts regular expressions patterns for search.
  • Replaces bytes by using their hexadecimal value.
  • Converts end lines into Unix, DOS/Windows and Mac OS formats.
  • Converts tabs to spaces and remove trailing spaces.

USAGE

$ sr [OPTION]... SEARCH REPLACE FILE...

Replace string SEARCH by string REPLACE into the specified file(s).

Use --help option for full options description.

$ sr --help

Examples

$ sr Hello Salut hello.txt Replace strings "Hello" by "Salut" in file hello.txt

$ sr Hello '' . Recursively delete "Hello" strings all files in the current directory

$ sr -d Hello '' . Simulate (dry-run mode) the recursive deletion of strings "Hello" in all files in the current directory

$ sr -e '[hH]ello' Salut hello.txt Replace strings that match regular expression "[hH]ello" by "Salut" in file hello.txt

$ sr -U hello.txt Set file hello.txt endlines into Unix format

BUILD

Requires cmake and make. In the root project directory, execute :

$ cmake CMakeLists.txt $ make

Dynamic libraries dependancies

  • libboost_system.so
  • libboost_chrono.so
  • libboost_filesystem.so
  • libboost_program_options.so
  • libboost_regex.so

Operating Systems support

The application is based on boost libraries which means the application can compile on most of the operating systems like Linux, BSD, Windows, Mac OS. I actually only compiled for Linux, if requested I can put efforts in compiling for other OS.