Warning: include(/home/content/m/t/v/mtv123/html/muhammadsafwat/wp-content/plugins/wp-super-cache/wp-cache-base.php) [function.include]: failed to open stream: No such file or directory in /home/content/17/6671517/html/muhammadsafwat/wp-content/plugins/wp-super-cache/wp-cache.php on line 65

Warning: include() [function.include]: Failed opening '/home/content/m/t/v/mtv123/html/muhammadsafwat/wp-content/plugins/wp-super-cache/wp-cache-base.php' for inclusion (include_path='.:/usr/local/php5_3/lib/php') in /home/content/17/6671517/html/muhammadsafwat/wp-content/plugins/wp-super-cache/wp-cache.php on line 65

Warning: include_once(/home/content/m/t/v/mtv123/html/muhammadsafwat/wp-content/plugins/wp-super-cache/ossdl-cdn.php) [function.include-once]: failed to open stream: No such file or directory in /home/content/17/6671517/html/muhammadsafwat/wp-content/plugins/wp-super-cache/wp-cache.php on line 82

Warning: include_once() [function.include]: Failed opening '/home/content/m/t/v/mtv123/html/muhammadsafwat/wp-content/plugins/wp-super-cache/ossdl-cdn.php' for inclusion (include_path='.:/usr/local/php5_3/lib/php') in /home/content/17/6671517/html/muhammadsafwat/wp-content/plugins/wp-super-cache/wp-cache.php on line 82
Removing multiple lines in a text using multiple search tokens

Removing multiple lines using multiple search tokens

Command Prompt
I got into this situation where I have a long list of lines in one file and also a long list of words for which I want to remove the corresponding lines in the first file.

Lets call the first file the “List.txt” and the second file is the “Tokens.txt”.

The Tokens.txt has a list of words or strings in each line The list.txt contains the list of lines we need to remove the tokens from. I searched for any tool online that allow the replacement or the removal of multiple lines based on multiple search inputs but I did not find anything after a long search. I tried NP++ and TextPad and Multiple Find and Replace but no use (It looks like this functionality was not thought about before) and finally I came up with the solution using DOS script and the FINDSTR Command

FINDSTR /v /g:Tokens.txt List.txt >result.txt

This command gets the search tokens from Tokens.txt and search for the lines containing these tokens in List.txt and then displays the lines which does not contain those tokens (the /v directive) and output the result in the file result.txt

 

In my case this was enough and strait forward but in your case you might want to use the regular expressions capabilities in the FINDSTR command.

 

Comments

comments

Post Comment

You must be logged in to post a comment.

Or