Skip to main content
Became Hot Network Question
added 136 characters in body
Source Link
terdon
  • 252.7k
  • 69
  • 481
  • 719

I needed to reverse the order of blank-separated words. GNU tac comes to mind and has an -s-option. which lets you set the separator:

 -s, --separator=STRING use STRING as the separator instead of newline 

So I tried:

$ echo -e A B C D E F | tac -s' ';echo F E D C B A $ echo -e A B C D E F | tac -s' ' | tr ' ' '-';echo F E-D-C-B-A- $ 

where the final echo is to have the next prompt on a separate line and the tr ' ' '-' is to see any invisible blanks at the end of the output lines.

What irritates me is the newline after the "F" in the output.

Looks like a bug to me, is it?

While writing this question and looking at the suggestions for similar questions (a very good feature), I saw Reversing a file line-wise and character-wise and learned about rev, which is exactly what I wanted.

Still, for tac, is it a bug or a feature?

I needed to reverse the order of blank-separated words. tac comes to mind and has an -s-option.

So I tried

$ echo -e A B C D E F | tac -s' ';echo F E D C B A $ echo -e A B C D E F | tac -s' ' | tr ' ' '-';echo F E-D-C-B-A- $ 

where the final echo is to have the next prompt on a separate line and the tr ' ' '-' is to see any invisible blanks at the end of the output lines.

What irritates me is the newline after the "F" in the output.

Looks like a bug to me, is it?

While writing this question and looking at the suggestions for similar questions (a very good feature), I saw Reversing a file line-wise and character-wise and learned about rev, which is exactly what I wanted.

Still, for tac, is it a bug or a feature?

I needed to reverse the order of blank-separated words. GNU tac comes to mind and has an -s-option which lets you set the separator:

 -s, --separator=STRING use STRING as the separator instead of newline 

So I tried:

$ echo -e A B C D E F | tac -s' ';echo F E D C B A $ echo -e A B C D E F | tac -s' ' | tr ' ' '-';echo F E-D-C-B-A- $ 

where the final echo is to have the next prompt on a separate line and the tr ' ' '-' is to see any invisible blanks at the end of the output lines.

What irritates me is the newline after the "F" in the output.

Looks like a bug to me, is it?

While writing this question and looking at the suggestions for similar questions (a very good feature), I saw Reversing a file line-wise and character-wise and learned about rev, which is exactly what I wanted.

Still, for tac, is it a bug or a feature?

mark up "rev"
Source Link
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k

I needed to reverse the order of blank-separated words. tac comes to mind and has an -s-option.

So I tried

$ echo -e A B C D E F | tac -s' ';echo F E D C B A $ echo -e A B C D E F | tac -s' ' | tr ' ' '-';echo F E-D-C-B-A- $ 

where the final echo is to have the next prompt on a separate line and the tr ' ' '-' is to see any invisible blanks at the end of the output lines.

What irritates me is the newline after the "F" in the output.

Looks like a bug to me, is it?

While writing this question and looking at the suggestions for similar questions (a very good feature), I saw Reversing a file line-wise and character-wise and learned about revrev, which is exactly what I wanted.

Still, for tac, is it a bug or a feature?

I needed to reverse the order of blank-separated words. tac comes to mind and has an -s-option.

So I tried

$ echo -e A B C D E F | tac -s' ';echo F E D C B A $ echo -e A B C D E F | tac -s' ' | tr ' ' '-';echo F E-D-C-B-A- $ 

where the final echo is to have the next prompt on a separate line and the tr ' ' '-' is to see any invisible blanks at the end of the output lines.

What irritates me is the newline after the "F" in the output.

Looks like a bug to me, is it?

While writing this question and looking at the suggestions for similar questions (a very good feature) I saw Reversing a file line-wise and character-wise and learned about rev, which is exactly what I wanted.

Still, for tac, is it a bug or a feature?

I needed to reverse the order of blank-separated words. tac comes to mind and has an -s-option.

So I tried

$ echo -e A B C D E F | tac -s' ';echo F E D C B A $ echo -e A B C D E F | tac -s' ' | tr ' ' '-';echo F E-D-C-B-A- $ 

where the final echo is to have the next prompt on a separate line and the tr ' ' '-' is to see any invisible blanks at the end of the output lines.

What irritates me is the newline after the "F" in the output.

Looks like a bug to me, is it?

While writing this question and looking at the suggestions for similar questions (a very good feature), I saw Reversing a file line-wise and character-wise and learned about rev, which is exactly what I wanted.

Still, for tac, is it a bug or a feature?

Source Link

tac-command is it a bug or a misinterpretation of the manual?

I needed to reverse the order of blank-separated words. tac comes to mind and has an -s-option.

So I tried

$ echo -e A B C D E F | tac -s' ';echo F E D C B A $ echo -e A B C D E F | tac -s' ' | tr ' ' '-';echo F E-D-C-B-A- $ 

where the final echo is to have the next prompt on a separate line and the tr ' ' '-' is to see any invisible blanks at the end of the output lines.

What irritates me is the newline after the "F" in the output.

Looks like a bug to me, is it?

While writing this question and looking at the suggestions for similar questions (a very good feature) I saw Reversing a file line-wise and character-wise and learned about rev, which is exactly what I wanted.

Still, for tac, is it a bug or a feature?