From a9c6c91ab38440326b04eb722496b92be26c764f Mon Sep 17 00:00:00 2001 From: "T. von Dein" Date: Mon, 15 Dec 2025 21:31:03 +0100 Subject: [PATCH] move to codeberg (#1) --- .woodpecker/build.yaml | 24 ++++++++++++++++++++++++ README.pod => README.md | 40 +++++++++++++++++++++++++--------------- t/file1 | 1 + 3 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 .woodpecker/build.yaml rename README.pod => README.md (65%) create mode 100644 t/file1 diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..20821d9 --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,24 @@ +matrix: + include: + # - image: perl:5.36.0-slim-bullseye + # - image: perl:5.38.0-slim-bookworm + # - image: perl:5.40.0-slim-bookworm + # - image: perl:5.42.0-slim-bookworm + - image: perl:5.43.5-slim-bookworm + +steps: + test: + when: + event: [push] + image: ${image} + commands: + - perl subst -r 's/2025/foobar/' t/file* + - grep foobar t/file* + - cp t/file1 t/huh.1 + - cp t/file1 t/mor.2 + - cd t + - perl ../subst -m 's/(huh|mor)/sub/g' '/.\d$/' + - cd .. + - ls -l t/sub.1 t/sub.2 + - perl subst -R -m 's/sub/ord/g' t + - ls -l t/ord.1 t/ord.2 diff --git a/README.pod b/README.md similarity index 65% rename from README.pod rename to README.md index ae1b6c9..e605773 100644 --- a/README.pod +++ b/README.md @@ -1,9 +1,11 @@ -=head4 subst - commandline tool to replace file contents or file names +[![status-badge](https://ci.codeberg.org/api/badges/15768/status.svg)](https://ci.codeberg.org/repos/15768) + +## subst - commandline tool to replace file contents or file names This script can be used to replace something in a file or filename by using perl regular expressions. It can also be used to rename files based on regexes. -=head4 Usage +## Usage Usage: subst [-M ] [-t] -r 's/old/new/' [ -r '...', ...] [ ... | /regex/] subst [-M ] [-tR] -m 's/old/new/' [ -m '...', ...] [ ... | /regex/] @@ -33,38 +35,46 @@ regular expressions. It can also be used to rename files based on regexes. Substitution regex must be perlish. See 'perldoc perlre' for details. -=head4 Samples +## Samples replace "tom" with "mac" in all *.txt files: - subst -r 's/tom/mac/g' *.txt + subst -r 's/tom/mac/g' *.txt rename all jpg files containing whitespaces: - subst -m 's/ /_/g' '/.jpg/' + subst -m 's/ /_/g' '/.jpg/' decode base64 encoded contents - subst -M MIME::Base64 -r 's/([a-zA-Z0-9]*)$/decode_base64($1)/gem' somefile + subst -M MIME::Base64 -r 's/([a-zA-Z0-9]*)$/decode_base64($1)/gem' somefile turn every uri into a link - subst -M "Regexp::Common qw /URI/" -r 's#($RE{URI}{HTTP})#link#g' somefile + subst -M "Regexp::Common qw /URI/" -r 's#($RE{URI}{HTTP})#link#g' somefile -=head4 DEPENDENCIES +## DEPENDENCIES -B is a perl script and as such needs perl. +`subst` is a perl script and as such needs perl. -=head4 Installation +## Installation -Copy L to B<$HOME/bin/subst>, that's all. +Copy [subst](subst) to `$HOME/bin/subst`, that's all. No additional perl modules are required. -=head4 Version +## Copyleft and License -1.1.5. +Copyright (c) 2002-2025 - T.v. Dein + +This software is licensed under the GNU GENERAL PUBLIC LICENSE version 3. + +## Authors + +T.v.Dein + +## Project homepage + +https://codeberg.org/scip/subst -Copyright (c) 2002-2021 - T.v. Dein -=cut diff --git a/t/file1 b/t/file1 new file mode 100644 index 0000000..8b306d0 --- /dev/null +++ b/t/file1 @@ -0,0 +1 @@ +Mon Dec 15 09:03:48 PM CET 2025