sebastiano.tronto.net

Source files and build scripts for my personal website
git clone https://git.tronto.net/sebastiano.tronto.net
Download | Log | Files | Refs | README

rev.md (728B)


      1 # UNIX text filters, part 2.3 of 3: rev
      2 
      3 *This post is part of a [series](../../series)*
      4 
      5 Of all the simple programs I am dedicating a post to in this series,
      6 `rev` is probably the simplest of them all.  So simple that it is
      7 easy to forget about: `rev` prints each line of standard input to
      8 standard output, reversing the order of the characters. For example:
      9 
     10 ```
     11 $ printf 'This is\na very short post' | rev
     12 si sihT
     13 tsop trohs yrev a
     14 ```
     15 
     16 Since [text is complicated](https://www.youtube.com/watch?v=gd5uJ7Nlvvo),
     17 `rev` will read the environment variable `LC_CTYPE` to determine what
     18 constitutes a character.
     19 
     20 And that's it. See you soon for another (longer) post in this series.
     21 
     22 *Next in the series: [cut](../2024-03-28-cut)*