Bash newbie.
I have three files. They have differing numbers of columns but the first three columns are the same across the files: name, id, year.
In no particular order, I am trying to: sort the data on name (Column 1), eliminate rows not in the year range(Column 3), eliminate rows not containing an id (Column 2).
I’ve tried place the sort command before the awk command, outside awk and on a separate line. This was my last attempt that isn’t working.
for arg in “$@”
awk -F’t’ ‘(int($3) < 2011 || int($3) > 2021) || $2 == “”{print $0 | “sort -k1”}’ $arg > “_$arg”
done
The output I’m hoping for is three file sorted by name.
Thank you.