ranjan_jajodia has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I need to delete the first line of a file, i.e, if a file's content were:
perl -p -i -e "s/[^\n]*\n//" test.txt
Could any one tell me what is wrong over here and what is the correct way?
Regards
Ranjan
I need to delete the first line of a file, i.e, if a file's content were:
After editing it should become:JohnGalt DagnyTagart HenryHankRearden
I have tried the following command but it seems to delete all lines even though I did not put g(global) option:DagnyTagart HenryHankRearden
perl -p -i -e "s/[^\n]*\n//" test.txt
Could any one tell me what is wrong over here and what is the correct way?
Regards
Ranjan
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: deleting first line of a file using in-place editing
by davido (Cardinal) on Sep 08, 2005 at 06:37 UTC | |
Re: deleting first line of a file using in-place editing
by sk (Curate) on Sep 08, 2005 at 06:39 UTC | |
Re: deleting first line of a file using in-place editing
by greenFox (Vicar) on Sep 08, 2005 at 06:41 UTC | |
Re: deleting first line of a file using in-place editing
by monkfan (Curate) on Sep 08, 2005 at 06:37 UTC | |
Re: deleting first line of a file using in-place editing
by ranjan_jajodia (Monk) on Sep 08, 2005 at 06:44 UTC |
Back to
Seekers of Perl Wisdom