Is there a program that copies in reverse order?
I am looking for a program that copies programs in byte reverse order. Something similar to dd where bs and count can be specified. Is there currently a commandline program that exists for that?
ie. Code:
file1: abcdefghijklmnopqrstuvwxyz |
Code:
tac -r -s '.\| ' |
Thank you, That works! I had to add the flag -b
Code:
tac -b -r -s '.\|' file1 Why do you escape the pipe? Seems to have some strange nuances. GNU BRE adds alteration by escape. You originally had '.\| ', which means any character except new line (. == [^n]) or space. Technically, '.\|' does not make sense to me, so I am not sure why it works. I'd prefer to avoid regex if possible. |
See also http://linux.die.net/man/1/rev
|
Quote:
because the pipe has actual significance in a Linux shell Code:
ls | less Code:
ls \| less one pipes the output of ls into the less command the other tries to list the file named | and a file named less the pipe takes output of one command and uses it as the input for the next, unless escaped. understand? |
Quote:
With regards to the pipe, it's an "or": there's a space after the pipe, so it's saying "match anything except a newline". If you didn't escape it, it would literally be matching the sequence "any character, then |, then a space" which isn't what you want. |
If the distro you're using has the rev command, you could just use that without any args.
|
Quote:
Take for example: helloworld abcdef 12345 rev produces: echo -e "hello world\nabcdef\n12345" | rev dlrow olleh fedcba 54321 rev | tac produces echo -e "hello world\nabcdef\n12345" | rev | tac 54321 fedcba dlrow olleh |
Quote:
Quote:
The pipe is an GNU extension to POSIX BRE. The original suggestion was escape . or white space. My change was to remove the white space which should be nothing. |
All times are GMT -5. The time now is 04:16 AM. |