Skip to main content
added 7 characters in body
Source Link
NIZ
  • 243
  • 1
  • 5

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. :)

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 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. :)

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. :)

Source Link
NIZ
  • 243
  • 1
  • 5

How to turn Diff command into bash script with prompt

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 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. :)