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
Post a Comment