substring match in specific column
Dear all,
I have a matrix with several lines and columns. Befeore doing analysis I want to clean it a bit and get just those lines whose column two match some specific substrings requirements. Here is an example: Picture pic_alpha_A 224 45 Picture alpha 23 49 Picture pic_alpha_CA 234 56 Picture alpha 88 12 Picture pic_beta_CC 999 456 I would like to have just those line containing "pic" in column two: Picture pic_alpha_A 224 45 Picture pic_alpha_CA 234 56 Picture pic_beta_CC 999 456 I guess I would need a modified version of this awk below: awk '$2 == "pic"{print $0}' infile.txt >> outfile.txt Please note that "pic" is separated from the rest with the "_" delimeter. Any suggestion is higly appreciated. Sincerely, Emiliano |
Code:
awk '$2 ~ /^pic/' file |
But of course!!!
Thanks grail. All the best, Udiubu |
All times are GMT -5. The time now is 10:14 PM. |