0 0 Votes

Remove arbitrary Text up to certain Word from Text File

Question by Mail Request | 11/07/2014 at 13:14

I have several text files, approximately having the following structure:

Arbitrary text including arbitrary information
Author: arbitrary name
Any other random text

I would like to remove the "header" from those files. Everything before the word "Author" belongs to the header. The difficulty is that the information given in the header can differ and are not always the same, so that I cannot use the normal Search and Replace function.

After the replacement, my file should look like this:

Author: arbitrary name
Any other random text

How can I use the TextConverter tool to delete all characters and words from the start/beginning of a file up to a certain string?

ReplyPositiveNegative

Stefan Trost

Show Profile | Message
Avatar
0Best Answer
0 Votes

This task can be done in the TextConverter, for example with using regular expressions.

  1. Activate the option "Actions > Replace Text"
  2. Activate the options "Use Regular Expression" for both, the search box as well as the replace box.
  3. Search for: .*(Author.*)
  4. Replace by: $1

By replacing ".*(Author.*)" with "$1", you should get your desired result. The regular expression in the search box finds arbitrary characters up to the word "Author" and arbitrary characters after this word. The $1 in the replace box, replaces with the characters, that has been found in brackets - that he is everything except the characters written before "Author".

Alternative: If your header should have a fixed number of lines, you can also use the function "Actions > Delete Lines". Here you can enter for example "1-3", "1,2" or "1" in the field "Delete these lines" to remove the specified lines from the beginning of the text file.

PS: Always have a look in the preview to ensure, that the result is correct.
11/07/2014 at 13:26

ReplyPositive Negative
Reply

Related Topics

Print Word in all System Fonts
Tutorial | 0 Comments
MIME Type of INI Files
Question | 1 Answer
PHP: Cut off String at last Space
Open Question | 1 Answer

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own articles on askingbox.com. How to do.