linux - Problem removing duplicate files using awk -


contents of part3.1.awk

{ current_line=$0 if (current_line!=prev) {     print $1 " -> " " -> " $5 " -> " $8 } prev=$0 } 

to list of processes, run in terminal. want output removed duplicates , sorted too.

$ps -ef | awk -f part3.1.awk | sort

what wrong doing?

you sorting output awk script, when want sorting input.

$ps -ef | awk -f part3.1.awk | sort 

should be

$ps -ef | sort | awk -f part 3.1.awk 

but should tell you don't need awk remove duplicates. sort -u you, in

ps -ef | sort -u


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -