yes! this command is very useful but in some cases it also give header along with the extracted data
awk '$5 >= 6000' "employee" | grep -v tsalary | sort -k 5
500 Vicky DBA Technology 6000
300 Sanjay Sysadmin Technology 7000
400 Nisha Manager Marketing 9500
id Name tDesignation tDepartment tSalary
And that is why I dont understand why $1 == Name removes the "Name" line and shows the remaining values...
Because $1 is not empty -> it contains 'Name'... (and then the names...)
Cant wrap my head around that.
(can you 'follow' my confusion?)
And the TO did/does not want the header-line shown, that is why I settled for $1 ==! "Name"
It doesn't. It would remove any line with an emtpy $1, of which there is none. You can leave it out entirely. The $4 < 7000 removes the header line. $4 > 7000 would not; we'd need a different criterion, then.
Hmm - that ==! is a construct that I can't get my head around. It obviously is a correct syntax - no complaints by the interpreter. So the == must be separated from the ! which then logically negates the NAME variable's contents and results in a 1 or 0 which in turn is tried to be matched against $1 . And, so it is. Add a line starting with a 0 or 1 and see what's going to happen.