How to use sed and regex? -
i need use sed lines in file pattern "[whatever]|[whatever]" i'm using following regex:
sed '/\"[a-za-z0-9]+\|[a-za-z0-9]+\"/p' test2.txt
but it's not working because in file returning when shouldn't
rtv0031605951us|3160595|20/03/2013|0|"laurie graham"|"401"
does know regex should use? in advance
i see 3 problems regular expression:
+
not metacharacter, need escape special meaning.- similar issue happens pipe. neither metacharacter, don't escape match literally.
sed
default prints each line matches, add-n
avoids that, if use/p
prints it. otherwise have lines twice in output.
Comments
Post a Comment