Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
when I substitute it with any string it is done but when I am inserting newline as in above code it is giving error. I don't want to do it with sed as I know sed works only in linux. If someone can help me to insert a newline after every four lines using perl and not sed.use strict; use warnings; my @files= @ARGV; for my $input_file (@files) { system "sed -i '0~4 s/\$/\n/g' $input_file"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: put a newline character after every four lines in a file
by haukex (Archbishop) on Feb 24, 2017 at 06:27 UTC | |
by Anonymous Monk on Feb 24, 2017 at 06:40 UTC | |
by haukex (Archbishop) on Feb 24, 2017 at 15:13 UTC | |
by Anonymous Monk on Feb 24, 2017 at 06:53 UTC | |
Re: put a newline character after every four lines in a file
by shawnhcorey (Friar) on Feb 24, 2017 at 14:01 UTC |