printing - How to print specific field that matches with a regex in awk -


it simple question didn't find answer...
have tab separated files many rows , different number of fields in each row. this:

a1_j a2_f a3_f a10_g a8_t a2_e a2_j a6_h a8_o  a9_g 

i want print fields start a2, not whole line, matched fields.like this:

a2_f a2_e a2_j 

i tried awk, no success.

i use grep this:

grep -o 'a2_[a-z]' file 

the -o switch means matches printed, each on separate line.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -