Questions tagged [tac]

5 questions
12
votes
2 answers

Explanation of tac --before

-b, --before The separator is attached to the beginning of the record that it precedes in the file. And I can't understand the following output: $ echo -e "Hello\nNew\nWorld\n!" > file $ tac file ! World New Hello $ tac -b…
SantaXL
  • 355
  • 1
  • 15
6
votes
2 answers

reverse file character by character using tac

I want to use the tacto reverse a text file character by character. On the info page for coreutils I found an example saying: #Reverse a file character by character tac -r -s 'x\|[^x]' However running tac -r -s seems to open standard input instead…
Weezy
  • 529
  • 1
  • 6
  • 16
2
votes
3 answers

Reversing a file line-wise and character-wise

Input: hello enrico output: ocirne olleh To do this, I can simply tac a file and pipe the output to rev (or the other way around), so one function that does the job is just this: revtac() { tac "$@" | rev; } Is there a built-in function for the…
Enlico
  • 1,471
  • 16
  • 35
1
vote
3 answers

How to concatenate files in reverse order

I am looking to concatenate a list of files in a directory in the reverse order that they appear in the list. This is different from tac as tac will concatenate the files with reversed line order. Basically I have a folder with 3 files, file1, file2…
1
vote
1 answer

Usage of readarray and tac

I have a file containing "lines" of text, for now only two lines. I need to create a reversed array of these lines - FIFO style. Using "readarray" in this fashion works fine: readarray -t FileArray < "$PWD$DEBUG_DIR$DEBUG_MENU" When I attempt to…
user238756