in reply to Removing leading whitespace from a file?
Hope this helps,,,#!/usr/bin/perl -w use strict; use fatal; use File::Copy; open( FH, "<test.txt" ); open( FH2, ">test.txt.tmp" ); while ( <FH> ) { s/^(\s+)//g; print FH2 $_; } close FH; close FH2; move("test.txt.tmp", "test.txt");
PS. check out perldoc perlrun to learn how to do this in one line.
update: atcroft, runrig and Zaxo: are you guys on a race or something?
|
|---|