Results for “duplicate lines”
Small, practical examples. Search by task or narrow things down below.
Process the lines of an in-memory string
Java: Use String.lines to handle common line terminators without retaining them.
Java✓ Tested
Read buffered lines from a file
Read buffered lines from a file in a complete Rust program using the standard library.
Rust✓ Tested
Read complete lines into an array
Bash Scripts: Mapfile with -t removes each line terminator but preserves other whitespace.
Bash Scripts✓ Tested
Reject duplicate business identifiers
SQL: A UNIQUE constraint protects a business key independently of the primary key.
SQL✓ Tested
Reject duplicate business identifiers
SQL Server: A UNIQUE constraint protects a business key independently of the primary key.
SQL Server✓ Tested
Reject duplicate business identifiers
Postgres: A UNIQUE constraint protects a business key independently of the primary key.
Postgres✓ Tested
Reject duplicate business identifiers
SQLite: A UNIQUE constraint protects a business key independently of the primary key.
SQLite✓ Tested
Remove adjacent duplicates from a sorted array
C: Compact equal neighbors with a write index after sorting or otherwise establishing order.
C✓ Tested
Remove blank or whitespace-only lines
Linux Commands: Use a POSIX character class so tabs and spaces are handled together.
Linux Commands✓ Tested
Remove duplicate records by a selected key
C#: DistinctBy keeps the first record for each key in encounter order.
C#✓ Tested
Remove duplicate result values
SQL: Use DISTINCT when repeated category values are not useful.
SQL✓ Tested
Remove duplicate result values
SQL Server: Use DISTINCT when repeated category values are not useful.
SQL Server✓ Tested