[Solved] i have a file all field are same then print line in bash? field is not fix [closed]
Here’s a solution using awk awk -F ‘;’ ‘{same=1; for (i=3;i<NF;i++) { if ($i != $2) { same=0 } }; if (same == 1) {print $0}}’ file Here’s how it works ‘{ same=1; #assume all fields are the same for (i=3;i<NF;i++) { #for each field after the second if ($i != $2) { same=0 } … Read more