awk '{ if (a[$1]++ == 0) print $0; }' "$@"
This is a standard (very simple) use for associative arrays.
More Related Contents:
- Remove non-ASCII characters from CSV
- Remove multi-line comments
- Insert a line at specific line number with sed or awk
- delete a column with awk or sed
- remove ^M characters from file using sed
- How to use awk to print lines where a field matches a specific string?
- What is the difference between sed and awk? [closed]
- shell – remove numbers from a string column [closed]
- sed fails with “unknown option to `s'” error [closed]
- How to select lines between two marker patterns which may occur multiple times with awk/sed
- How can I do a recursive find/replace of a string with awk or sed?
- Bash tool to get nth line from a file
- How to delete duplicate lines in a file without sorting it in Unix
- How can I delete a newline if it is the last character in a file?
- Why doesn’t `\d` work in regular expressions in sed? [duplicate]
- Extraction of data from a simple XML file
- How to add to the end of lines containing a pattern with sed or awk?
- Can I programmatically “burn in” ANSI control codes to a file using unix utils?
- Do a tail -F until matching a pattern
- What are the differences between Perl, Python, AWK and sed? [closed]
- Removing Windows newlines on Linux (sed vs. awk)
- Uppercasing First Letter of Words Using SED
- Batch script to replace PHP short open tags with
- Sed to extract text between two strings
- Insert multiple lines into a file after specified pattern using shell script
- Extract lines between two patterns from a file [duplicate]
- sed gives me “: unexpected EOF (pending }’s) error and I have no idea why
- Have sed ignore non-matching lines
- Awk replace a column with its hash value
- How to delete rows from a csv file based on a list values from another file?