Bulk Command Reference

ETWriter includes a command language for transforming text across multiple files. Commands are executed in the order they appear in the command editor. This reference documents the nine supported command types.

Syntax

Each command occupies one line:

COMMAND|ARGUMENT1|ARGUMENT2

Arguments are separated by the pipe character (|).

Some commands require only one argument, while others require two.

Command Summary

CommandArgumentsAction
FIND_APPEND2Insert a new line after each line containing a match
FIND_BREAK1Insert a blank line after each matching line
FIND_INSERT2Insert text immediately after every occurrence of a match
FIND_REPLACE2Replace every occurrence of matching text
FIND_DELETE1Remove every occurrence of matching text
LINE_APPEND2Insert a new line after a specified line
LINE_BREAK1Insert a blank line after a specified line
LINE_REPLACE2Replace a specified line
LINE_DELETE1Delete a specified line

Command names are case-insensitive.

Search operations use literal text matching rather than regular expressions.


FIND_APPEND

Syntax

FIND_APPEND|SEARCH_TEXT|NEW_LINE

Inserts a new line after each line containing the specified search text.

Example

Command:

FIND_APPEND|TODO|// Follow-up required

Input:

Complete the feature.
TODO: Review implementation.
Continue testing.

Output:

Complete the feature.
TODO: Review implementation.
// Follow-up required
Continue testing.

Behavior

The search uses case-sensitive substring matching.

If several lines contain the search text, a new line is inserted after each one.

The original matching lines are retained.


FIND_BREAK

Syntax

FIND_BREAK|SEARCH_TEXT

Inserts an empty line after every line containing the search text.

Example

Command:

FIND_BREAK|Section

Input:

Section A
Content A
Section B
Content B

Output:

Section A

Content A
Section B

Content B

Behavior

The command inserts a new blank line after each matching line.


FIND_INSERT

Syntax

FIND_INSERT|SEARCH_TEXT|INSERT_TEXT

Inserts text immediately after each occurrence of the matching substring.

Example

Command:

FIND_INSERT|version|_updated

Input:

version=1

Output:

version_updated=1

Behavior

All occurrences are processed, including multiple matches within the same line.

This operation inserts text within existing lines rather than creating a separate line.


FIND_REPLACE

Syntax

FIND_REPLACE|SEARCH_TEXT|REPLACEMENT_TEXT

Replaces every occurrence of the specified search text.

Example

Command:

FIND_REPLACE|localhost|example.com

Input:

API_URL=http://localhost

Output:

API_URL=http://example.com

Behavior

Replacement is literal and case-sensitive.

All occurrences within every line are replaced.

No regular expression syntax is applied.


FIND_DELETE

Syntax

FIND_DELETE|SEARCH_TEXT

Deletes every occurrence of matching text.

Example

Command:

FIND_DELETE|DEBUG:

Input:

DEBUG: Starting application

Output:

 Starting application

Behavior

The matching substring is removed, but the remainder of the line is preserved.

This command does not delete entire lines containing the search text.

For entire-line deletion, use LINE_DELETE with a line number.


LINE_APPEND

Syntax

LINE_APPEND|LINE_NUMBER|NEW_LINE

Inserts a new line after the specified line number.

Example

Command:

LINE_APPEND|2|Inserted line

Input:

First line
Second line
Third line

Output:

First line
Second line
Inserted line
Third line

Special Positions

NumberBehavior
0Insert before the first line
1Insert after the first line
2Insert after the second line
-1Append at the end
Greater than line countAppend at the end
Other negative valuesInsert at the beginning

LINE_BREAK

Syntax

LINE_BREAK|LINE_NUMBER

Inserts an empty line after the specified line number.

Example

Command:

LINE_BREAK|1

Input:

Heading
Description

Output:

Heading

Description

Special Positions

LINE_BREAK follows the same insertion-position rules as LINE_APPEND.

For example:

LINE_BREAK|0

inserts an empty line before the existing first line.


LINE_REPLACE

Syntax

LINE_REPLACE|LINE_NUMBER|NEW_CONTENT

Replaces the entire specified line.

Example

Command:

LINE_REPLACE|2|Updated second line

Input:

First line
Original second line
Third line

Output:

First line
Updated second line
Third line

Special Positions

NumberBehavior
0Replace the first line
1Replace the first line
-1Replace the last line
Positive numberReplace that numbered line
Out-of-range numberNo change

Line numbering is otherwise one-based.


LINE_DELETE

Syntax

LINE_DELETE|LINE_NUMBER

Deletes the specified line.

Example

Command:

LINE_DELETE|2

Input:

First line
Remove this line
Third line

Output:

First line
Third line

Special Positions

NumberBehavior
0Delete the first line
1Delete the first line
-1Delete the last line
Positive numberDelete that numbered line
Out-of-range numberNo change

Escape Sequences

ETWriter recognizes selected escape sequences within command arguments.

SequenceInterpretation
\nNewline
\tTab
\\Backslash

Example

Command:

FIND_REPLACE|Hello|Hello\nWorld

Input:

Hello

Output:

Hello
World

The replacement argument contains an actual newline after escape processing.

Important Parsing Rules

Pipe Delimiters

ETWriter separates commands with:

line.split("|")

Only the first two arguments are used.

A literal pipe inside an argument is not supported by an escaping mechanism in the supplied parser.

Empty Lines

Blank command lines are ignored.

Whitespace

The parser trims each entire command line.

Whitespace within arguments is otherwise retained.

Literal Matching

The FIND commands use literal string matching and are case-sensitive.

For example:

FIND_DELETE|error

does not remove uppercase ERROR.

No Regex Matching

The bulk command parser does not interpret search arguments as regular expressions.

For example:

FIND_REPLACE|\d+|number

searches for the literal characters \d+, after the parser's supported unescaping rules have been applied. It does not match arbitrary numbers.

Command Order Matters

Commands execute sequentially.

For example:

LINE_DELETE|1
LINE_DELETE|1

deletes the first line, then deletes the new first line.

Similarly:

FIND_REPLACE|alpha|beta
FIND_REPLACE|beta|gamma

can transform alpha into gamma.

Complete Example

Suppose the input is:

Project: Demo
Version: 1
TODO: Review
Status: Draft

Commands:

FIND_REPLACE|Version: 1|Version: 2
FIND_APPEND|TODO:|Reminder: Complete review
LINE_DELETE|-1
LINE_APPEND|-1|Status: Updated

Result:

Project: Demo
Version: 2
TODO: Review
Reminder: Complete review
Status: Updated

Unsupported Command

The source contains a reference to APPEND_LINE as an alias, but the parser rejects it before alias normalization occurs.

Use the supported command name:

LINE_APPEND|3|New line

rather than:

APPEND_LINE|3|New line

Safety Recommendations

  • Test transformations on sample files.
  • Review command order.
  • Avoid empty FIND search strings.
  • Preserve original files.
  • Verify all generated output.

Warning: An empty search argument may produce unexpected behavior. The implementation does not explicitly reject empty search strings for FIND commands.


Did this page help you?