I want to know how to use grep
in order to display all lines that begin and end with the same character.
Grep command to display all lines that begins and ends with same character
greptext processing
greptext processing
I want to know how to use grep
in order to display all lines that begin and end with the same character.
Best Answer
POSIXly:
It won't work if line starts or ends with invalid byte character, if you want to cover that case, you can add
LC_ALL=C
, althoughLC_ALL=C
works with single-byte character data only.perl6
seems to be the best tool, if you have it in your box:Although it still chokes on invalid characters.
Note that
perl6
will alter your text by turning it toNFC
form:Internally,
perl6
stores string inNFG
form (stand forNormalization Form Grapheme
), which isperl6
invented way to deal with un-precomposed graphemes properly: