How to search for asterisks using gawk
I want to use gawk to search for asterisks within a file, call it error.txt
I write: gawk '/*/' error.txt >> error2.txt of course it copies everything to error2 because * is a wildcard. However, I would like to search for lines containing a literal asterisk. This must be possible somehow. I prefer not to use sed to change the asterisks. |
When searching for special characters like that, it's necessary to 'escape' the character by preceding it with a backslash '\'. That tells gawk (and most other programs which deal with regular expressions) to treat the next character literally. Like so:
gawk '/\*/' error.txt >> error2.txt |
All times are GMT -5. The time now is 07:35 AM. |