Here is a little inplace edit script to play with (backup with .bak suffix written):
cheers#!/usr/bin/perl -i.bak -w @ARGV = ('c:/test.txt'); # set our file to process while (<>) { print "newline\n" if m/somecond/; # add a new line is line matches +somecond s/this/that/; # substitute this for that on eve +ry line print; # write the modified (or not) lin +es }
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Printing to a specific place in a file
by tachyon
in thread Printing to a specific place in a file
by lagrenouille
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |