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:

  1. + not metacharacter, need escape special meaning.
  2. similar issue happens pipe. neither metacharacter, don't escape match literally.
  3. sed default prints each line matches, add -n avoids that, if use /p prints it. otherwise have lines twice in output.

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -