I have thousands of .tsv files where I am extracting the rows where column 2 is equal column 6.
I can use the below bash script, but I could not append column names (header) in the output.
What is the way to include header?
for x in *.tsv; do
awk '$2==$6' <"$x" >"$x.tmp"
mv "$x.tmp" "$x"
done