Tuesday, March 15, 2011

using ed and regex to strip extrastuff from end of 8 ips on 8 lines

http://wiki.bash-hackers.org/doku.php?id=howto:edit-ed

how can I get rid of whatever is after 6.1 on 8 lines?
[13:29] say 192.168.6.1sdgdfgdf
[13:29] and 192.168.6.199fdes
[13:29] I know 1,2 s/something/something/
[13:29] but how do I express "stuff after 6.1?"
[13:30] you have to do s/6\.1.*/6.1/
[13:34] wow
[13:34] worked perfectly
[13:34] so escape the first dot, and add a .*
[13:34] hmm
[13:34] interesting
[13:34] why .*?
[13:35] does it mean "any character, and anything after?"
[13:35] yes
[13:39] thank you
[13:39] :)

No comments: