commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
i wanted to delete all duplicate lines from .bash_history and keep the order of the other lines.
the command cat's the file and adds line numbers, then sorts by the second column. afterwards uniq omits repeated lines, but skips the first field (the line number). then it sorts by the line numbers and at the end cuts the numbers off.
There are 3 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.