perl -pi -le 'print "New line added!!" if $. == 100' example.txt
If you want to insert the same line in multiple files, use the following:
perl -pi -le 'print "New line added!!" if $. == 100; close ARGV if eof' *.txt
('close ARGV if eof' is needed to reset the variable '$.' before processing the next file).
No comments:
Post a Comment