I was wondering if there was a simple way to add exceptions to the [[:punct:]] bracket expression when using tr utility:
cat *.txt | tr '[[:punct:]]' '\012'
for instance: do not do anything if the punctuation characters are - or ).
Join Stack Overflow to learn, share knowledge, and build your career.
|
I was wondering if there was a simple way to add exceptions to the
for instance: do not do anything if the punctuation characters are - or ). |
||||
|
|
|
You can use a negative look-ahead: This will first check whether the next character is neither a edit: since tr apparently doesn't support Regex (only basic POSIX), you should use another utility, e.g. sed: |
|||||||||||||||||||||
|