How to remove caracters like (), ' * [] form a grep results with grep, awk or sed?
- by easyyu
For example if I made a file with grep that give me a next result:
16 Jan 07:18:42 (name1), xx.210.49.xx),
16 Jan 07:19:14 (name2), xx.210.xx.24),
16 Jan 07:19:17 (name3), xx.140.xxx.79),
16 Jan 07:19:44 (name4), xx.210.49.xx),
16 Jan 07:19:56 (name5), xx.140.xxx.79),
,then how to sed awk or grep to remove all except date name and IP to look like this:
16 Jan 07:18:42 name1 xx.210.49.xx
16 Jan 07:19:14 name2 xx.210.xx.24
16 Jan 07:19:17 name3 xx.140.xxx.79
16 Jan 07:19:44 name4 xx.210.49.xx
16 Jan 07:19:56 name5 xx.140.xxx.79
My grep command look like this:
grep 'double' $DAEMON | awk -F" " '{print $2" "$1" "$3" "$8" "$10}' > $DBLOG
Thx.