13

How to search for pattern in odd lines?

view full story
linux-howto

http://www.unix.com – Hi friends, I am looking for sed command/script that would search for a given fixed pattern on odd lines and then if it matches, prints the matching pattern and the next line. For example, in the example below, i am looking for pattern 0 and 1011 on odd lines. ########## start of example file ############ 0 0 1000 x 1001 x 1010 x 1011 xxxxxxxxxxxxxxxx 1100 xxxxxxxxxxxxxxxxxxxx ################# end of example file ########## The output should be 0 0 1011 xxxxxxxxxxxxxxxx How to code this in sed? Thanks a lot for your response. (HowTos)