I want to use tac or tail -r piped on the end of my shell command. I want to inverse the output of words but not completely reverse the character order.

Like output every word in this sentence last to first, but don't output the letters in reverse. How do you do this in shell? Rev does not do what I want it to it reverses everything. Bonus points if you can do it one line without outputting a file that's cheating.

cc @p @newt @dushman @charlie_root @nishi @meso @dcc

Follow

@splitshockvirus
Not that there is any need to optimize shell shit, but in case you're ever going to reuse that, you can drop the tr β€” xargs will swallow all the extraneous whitespace anyway, including the newlines.
And even using awk is overkill in this case, unless it's a nod to Pete😏
There is a dumber, but still capable tool for that: cut
Use "cut -f1 -d' '" to filter out all but the first word before space on each line.
@dushman @meso @dcc @newt @charlie_root @m0xEE @nishi

Β· Web Β· 0 Β· 0 Β· 0
Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml