mirror of
https://codeberg.org/scip/subst.git
synced 2025-12-16 20:21:04 +01:00
move to codeberg (#1)
This commit is contained in:
24
.woodpecker/build.yaml
Normal file
24
.woodpecker/build.yaml
Normal file
@@ -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
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
=head4 subst - commandline tool to replace file contents or file names
|
[](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
|
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.
|
regular expressions. It can also be used to rename files based on regexes.
|
||||||
|
|
||||||
=head4 Usage
|
## Usage
|
||||||
|
|
||||||
Usage: subst [-M <perl module>] [-t] -r 's/old/new/<flags>' [ -r '...', ...] [<file> ... | /regex/]
|
Usage: subst [-M <perl module>] [-t] -r 's/old/new/<flags>' [ -r '...', ...] [<file> ... | /regex/]
|
||||||
subst [-M <perl module>] [-tR] -m 's/old/new/<flags>' [ -m '...', ...] [<file|dir> ... | /regex/]
|
subst [-M <perl module>] [-tR] -m 's/old/new/<flags>' [ -m '...', ...] [<file|dir> ... | /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.
|
Substitution regex must be perlish. See 'perldoc perlre' for details.
|
||||||
|
|
||||||
=head4 Samples
|
## Samples
|
||||||
|
|
||||||
replace "tom" with "mac" in all *.txt files:
|
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:
|
rename all jpg files containing whitespaces:
|
||||||
|
|
||||||
subst -m 's/ /_/g' '/.jpg/'
|
subst -m 's/ /_/g' '/.jpg/'
|
||||||
|
|
||||||
decode base64 encoded contents
|
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
|
turn every uri into a link
|
||||||
|
|
||||||
subst -M "Regexp::Common qw /URI/" -r 's#($RE{URI}{HTTP})#<a href="$a">link</a>#g' somefile
|
subst -M "Regexp::Common qw /URI/" -r 's#($RE{URI}{HTTP})#<a href="$a">link</a>#g' somefile
|
||||||
|
|
||||||
=head4 DEPENDENCIES
|
## DEPENDENCIES
|
||||||
|
|
||||||
B<subst> is a perl script and as such needs perl.
|
`subst` is a perl script and as such needs perl.
|
||||||
|
|
||||||
=head4 Installation
|
## Installation
|
||||||
|
|
||||||
Copy L<subst|https://github.com/TLINDEN/subst/blob/main/subst> to B<$HOME/bin/subst>, that's all.
|
Copy [subst](subst) to `$HOME/bin/subst`, that's all.
|
||||||
No additional perl modules are required.
|
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 <tom AT vondein DOT org>
|
||||||
|
|
||||||
|
## Project homepage
|
||||||
|
|
||||||
|
https://codeberg.org/scip/subst
|
||||||
|
|
||||||
Copyright (c) 2002-2021 - T.v. Dein
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user