📜  bash 返回从第 n 个字段开始的唯一行 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:04.736000             🧑  作者: Mango

代码示例1
# Basic syntax:
uniq -f number input_file
# Where number specifies the number of fields/columns to ignore from left 
#    to right when doing comparisons to return unique lines

# Note, uniq requires a sorted input. You can sort a file based on 
#    specific fields with sort -k start_field_#,end_field_#

# Example usage:
sort -k 5,7 input_file | uniq -f 5 # This would sort the file using 
#    fields 5-7 and then return unique lines based on a comparison 
#    starting at the 5th field