From f73cf241cf61e66e2adc7a57b966fe94c6b4a657 Mon Sep 17 00:00:00 2001 From: Ev Bogdanov Date: Wed, 16 Aug 2017 19:14:53 +0300 Subject: [PATCH] Rewrite case conversion scripts --- README.md | 6 +++--- bin/h+ | 2 +- bin/lc+ | 8 -------- bin/lower | 3 +++ bin/uc+ | 8 -------- bin/upper | 3 +++ 6 files changed, 10 insertions(+), 20 deletions(-) delete mode 100755 bin/lc+ create mode 100755 bin/lower delete mode 100755 bin/uc+ create mode 100755 bin/upper diff --git a/README.md b/README.md index c65dd26..f217e6c 100644 --- a/README.md +++ b/README.md @@ -88,14 +88,14 @@ Who is who in **bin** directory: - `git+ MESSAGE` git: commit and push to master - `h+ SYMBOL` draw a pretty heading - `hg+ MESSAGE` hg: commit and push to master -- `lc+` to lowercase +- `lower` convert selection to lowercase - `nobs+` taken from plan9 `nobs` (it removes all backspace characters and the characters that precede them) - `s-` remove leading whitespace - `s2t N_SPACES` spaces to tabs (default: 4 spaces to 1 tab) - `t2s N_SPACES` tabs to spaces (default: 1 tab to 4 spaces) - `t+` add tab - `t-` delete tab -- `uc+` to uppercase +- `upper` convert selection to uppercase Put these guys in your **$PATH**. @@ -145,7 +145,7 @@ Put these guys in your **$PATH**. - `Edit , > wc -l` count lines in file - `Edit , | sort` sort lines - `Edit 3,5p` print lines 3..5 in new window -- `Edit 3,5 |uc+` lines 3..5 upper cased +- `Edit 3,5 |upper` lines 3..5 upper cased - `Edit 3,5 s/HE/he/g` replace on 3..5 lines only - `Edit 2 d` delete second line - `Edit 2 a/new\n/` append text after 2nd line diff --git a/bin/h+ b/bin/h+ index fa08307..8dde379 100755 --- a/bin/h+ +++ b/bin/h+ @@ -8,7 +8,7 @@ if [ ! "$symbol" ]; then symbol='#' fi -line=$(sed 1q | uc+) +line=$(sed 1q | upper) echo "$symbol$symbol $line" echo "$symbol$symbol -----------------------------------------------------------------------------" diff --git a/bin/lc+ b/bin/lc+ deleted file mode 100755 index 8ca6911..0000000 --- a/bin/lc+ +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env perl - -use utf8; -use open qw(:std :utf8); - -while (<>) { - print lc $_; -} diff --git a/bin/lower b/bin/lower new file mode 100755 index 0000000..f91d5e1 --- /dev/null +++ b/bin/lower @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +tr '[:upper:]' '[:lower:]' diff --git a/bin/uc+ b/bin/uc+ deleted file mode 100755 index daa2bec..0000000 --- a/bin/uc+ +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env perl - -use utf8; -use open qw(:std :utf8); - -while (<>) { - print uc $_; -} diff --git a/bin/upper b/bin/upper new file mode 100755 index 0000000..83eb4e6 --- /dev/null +++ b/bin/upper @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +tr '[:lower:]' '[:upper:]'