I have a list that i've copy and i want to paste it to the shell to give me just the repeated lines.
1
1
3
2
As i read about bash commands i've maded this:
cat > /tmp/sortme ; diff <(sort /tmp/sortme) <(sort -u /tmp/sortme)
When i write the above command i paste my list and press CTRL+Z
to stop cat and it shows me the repeated lines. I don't want to compare files, just pasted input of several rows.
Now to the question: Is there any way to turn that command into script? Because when i try to make it as a script and CTRL+Z
stops it.
PS: Please don't laugh. This is my firs time trying. Till now just reading. :)
sort | uniq -d
(or-D
for all of them) to see duplicated lines. To say "end-of-file" when entering lines in a terminal, type CTRL-D. CTRL-Z is to suspend the current job.