Mercurial > octave
view build-aux/inplace-edit.pl @ 33416:48c2df4bb207
rename some files for consistency
Prefer hyphens over underscores in filenames. Use 'pl' extension for
Perl scripts.
* build-aux/inplace-edit.pl: Rename from build-aux/inplace_edit.pl.
* build-aux/module.mk: Update.
* doc/interpreter/doccheck/add-to-aspell-dict.pl:
Rename from doc/interpreter/doccheck/add_to_aspell_dict.
* doc/interpreter/doccheck/mk-undocumented-list.pl:
Rename from doc/interpreter/doccheck/mk_undocumented_list.
* doc/interpreter/graphics-properties.mk:
Rename from doc/interpreter/graphics_properties.mk.
* doc/interpreter/octave-logo.eps: Rename from
doc/interpreter/octave_logo.eps.
* doc/interpreter/octave-logo.pdf: Rename from
doc/interpreter/octave_logo.pdf.
* doc/interpreter/octave.texi: Update.
* doc/interpreter/module.mk: Update.
* etc/RELEASE-CHECKLIST.md: Rename from etc/RELEASE_CHECKLIST.md.
* etc/icons/octave-branding-samples.svg: Rename from
etc/icons/octave_branding_samples.svg.
* etc/module.mk: Update.
* scripts/profiler/html/flat-entry.html: Rename from
scripts/profiler/html/flat_entry.html.
* scripts/profiler/html/hierarchical-entry.htmle: Rename from
scripts/profiler/html/hierarchical_entry.html.
* scripts/profiler/module.mk, scripts/profiler/profexport.m: Update.
* scripts/testfun/private/html-plot-demos-template.html: Rename from
scripts/testfun/private/html_plot_demos_template.html.
* scripts/testfun/module.mk: Update.
* test/classdef-debug/test-classdef-breakpoints.tst: Rename from
test/classdef-debug/test_classdef_breakpoints.tst.
* scripts/testfun/private/html_compare_plot_demos.m
* test/json/jsondecode.tst: Rename from test/json/jsondecode_BIST.tst.
* test/classdef-debug/module.mk: Update.
* test/json/jsonencode.tst: Rename from test/json/jsonencode_BIST.tst.
* test/json/module.mk: Update
* test/jupyter-notebook/octave-kernel.ipynb: Rename from
test/jupyter-notebook/octave_kernel.ipynb.
* test/jupyter-notebook/plot-magic-and-errors.ipynb: Rename from
test/jupyter-notebook/plot_magic_and_errors.ipynb.
* test/jupyter-notebook/jupyter-notebook.tst,
test/jupyter-notebook/module.mk: Update.
* test/local-functions/local-functions.tst: Rename from
test/local-functions/local_functions.tst.
* test/local-functions/module.mk: Update.
* test/pkg/pkg/mfile-basic-test: Rename from
test/pkg/mfile_basic_test.
* test/pkg/mfile-minimal-test: Rename from
test/pkg/mfile_minimal_test.
* test/pkg/module.mk, test/pkg/pkg.tst: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 16 Apr 2024 12:36:15 -0400 |
parents | build-aux/inplace_edit.pl@8b548f2f8086 |
children |
line wrap: on
line source
#!/usr/bin/perl -w ################################################################################ ## File: inplace-edit.pl ## Usage: perl inplace-edit.pl 'PERL_CODE' file1 [file2] [...] ## Purpose: Run snippet of PERL_CODE on each line in a file and replace ## existing line with the results of running the code. ## This replaces perl -i -pe 'PERL_CODE' file1 [file2] ... ## due to a problem in Perl 5.28 which restricts the number of files ################################################################################ ## Create Perl code from first argument (-e CODE) eval "sub per_line_code { $ARGV[0]; }"; shift @ARGV; ## Loop over each file foreach $fname (@ARGV) { rename ($fname, "$fname.$$") or die "Rename failed:$fname:$!"; open (my $FHI, "<", "$fname.$$") or die "Open failed:$fname.$$:$!"; open (my $FHO, ">", "$fname") or die "Open failed:$fname:$!"; ## Loop over each line while (<$FHI>) { per_line_code (); print $FHO $_; } close ($FHI); close ($FHO); unlink "$fname.$$" or die "Delete failed:$fname.$$:$!"; }