CaffeineAddict
Well-Known Member
I'm working on a collection of commands to run against wordlists for optimization and have 3 questions regarding the command below.
The command (including vague description) is:
According to description it should remove all lines which contain non-printable character.
But it seems this is not correct, my interpretation of the command is that it will remove lines whose beginning starts with non-printable character, if a line ends with non-printable or if non-printable is in the middle of a line it will be preserved and slip out into "output.txt", is that correct?
If that is correct, how would I modify this command so that any lines which contain non-printable be removed, regardless of whether non-printable is in the beginning, end or in the middle of a line.
Lastly, I don't understand how grep works in this case, by some logic, reading the command from left to right, it appears that only matches are outputed into "output.txt", therefore since matches are lines with non-printable character it follows that only such lines should be outputed? but the truth is the reverse, which is, matches are NOT outputed to "output.txt" but discarded.
Why is that? which grep docs or resource state that matches are discarded rather than preserved?
I'm expecting matches (lines with non-printable) to be put into "output.txt" and the reset discarded, rather than vice versa.
The command (including vague description) is:
Bash:
# Get rid of passwords containing non-ascii or non-visible characters (except for the space)
grep --extended-regexp '^[[:print:]]*$' "input.txt" > "output.txt"
According to description it should remove all lines which contain non-printable character.
But it seems this is not correct, my interpretation of the command is that it will remove lines whose beginning starts with non-printable character, if a line ends with non-printable or if non-printable is in the middle of a line it will be preserved and slip out into "output.txt", is that correct?
If that is correct, how would I modify this command so that any lines which contain non-printable be removed, regardless of whether non-printable is in the beginning, end or in the middle of a line.
Lastly, I don't understand how grep works in this case, by some logic, reading the command from left to right, it appears that only matches are outputed into "output.txt", therefore since matches are lines with non-printable character it follows that only such lines should be outputed? but the truth is the reverse, which is, matches are NOT outputed to "output.txt" but discarded.
Why is that? which grep docs or resource state that matches are discarded rather than preserved?
I'm expecting matches (lines with non-printable) to be put into "output.txt" and the reset discarded, rather than vice versa.

