Saturday, March 5, 2016

filter by line and column in command line

Example

$ printf "%-8s %-8s %-8s\n%-8s %-8s %-8s"  "one" "two" "three" "um" "dois" "tres"

> one     two     three
> um      dois    tres

para mostrar a linha 2 coluna 2

$ printf "%-8s %-8s %-8s\n%-8s %-8s %-8s"  "one" "two" "three" "um" "dois" "tres" | awk '{ if (NR==2) print $2 }'

dois

No comments:

Blog Archive