bash:files:removing_duplicate_lines_from_files
Differences
This shows you the differences between two versions of the page.
bash:files:removing_duplicate_lines_from_files [2021/05/28 09:09] – created peter | bash:files:removing_duplicate_lines_from_files [2022/06/13 11:27] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== BASH - Files - Removing Duplicate Lines from Files ====== | ||
- | |||
- | <code bash> | ||
- | #! /bin/sh | ||
- | |||
- | echo -n "Enter Filename-> | ||
- | read filename | ||
- | if [ -f " | ||
- | sort $filename | uniq | tee sorted.txt | ||
- | else | ||
- | echo "No $filename in $pwd...try again" | ||
- | fi | ||
- | |||
- | exit 0 | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | |||
- | It then places the new content into a new file and keeps the original file intact. | ||
- | </ | ||
bash/files/removing_duplicate_lines_from_files.1622192982.txt.gz · Last modified: 2021/05/28 09:09 by peter