Batch, Developer Tool, Plugin, Programming

EDIT FILES WITHOUT OPENING THEM – EditLine by KVC

In this article, we are going to learn about the usage and functionality of the EditLine plugin written by KVC. This plugin allows you to edit and insert a text line in a file without opening them and overriding the entire content. You can download this plugin from our GitHub. This plugin is an improved and combined version of ReplaceLine/StrSurr utilities. Both of those were created by Kvc as well.

RELATED VIDEO

USAGE & EXAMPLES

Call EditLine [File] [LineNumber] [Marker 1] [Marker 2] [Text]

Where:
ver         :Displays version of program./?          :Displays help for the program.
File        :Name of the text file.
Line number :Line no edit/trim/modify.
Marker 1    :Text from where, to start edit.
Marker 2    :Text from where, to end edit.
Text        :Text to be inserted.

Example: To Edit a line

call EditLine designmap2.xml 2 "product=" ")" "6.0(31)"

The above command will edit the 2nd line from the designmap2.xml file, and replace the text between the markers with the text “6.0(31)”. You can use this utility to edit a line in a file, and also to insert a line.

Input: "<?aid style="50" featureSet="257" product="16.3(24)" ?>"

Output: "<?aid style="50" featureSet="257" product="6.0(31)" ?>"

Example: To Insert a Line

In this example, we will be inserting a line in the file named example.txt. The content of the files is shown in the picture below.

The file to be edited
editline example.txt 1 "editline" "." "A plugin created by KVC"

The above code will insert the line “A plugin created by KVC” between marker1(“editline”) and marker2(“.”) in the manner shown below.

How editline is used

CONCLUSION

This article was about the EditLine plugin, which will help users in editing a line or inserting a line in a file. I hope that you enjoyed the article. I hope you enjoyed reading this article, please share your thoughts below and make sure to join our Discord and YouTube community. for more plugins like this visit our site Batch-man. Thank you for reading.

Leave a Reply