ashok has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am counting no. of lines in a file using cat like this on a unix system.
This works fine. But one of the files having a blank in int's path like this.$line_count = `cat $filename | wc -l`
Then the above my code to count lines fails. Also some times when the path is big it breaks in to two lines and I unable to pickup the file name properly. I am reading file names from a file. So how to find the file name if in two lines in a file? For ex:Module: /org/trans/program files/src/apptask1.c.
I able to read first line /org/trans/program files/dir1/dir2/dir3/dir4/ only. I do not know when the file name breaks into two lines. Each file name is preceded by "Module: ". So my regular expression is to match a line beginning with 'Module: ' and pickup the remaining text as a file name. So can any one help me? Thanks AshokModule: /org/trans/program files/dir1/dir2/dir3/dir4/ dir5/apptask2.c
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: path is broken
by btrott (Parson) on Dec 06, 2000 at 23:55 UTC | |
by a (Friar) on Dec 07, 2000 at 07:02 UTC | |
Re: path is broken
by kilinrax (Deacon) on Dec 06, 2000 at 23:53 UTC | |
by gaspodethewonderdog (Monk) on Dec 07, 2000 at 00:03 UTC | |
by Ovid (Cardinal) on Dec 07, 2000 at 00:15 UTC | |
by btrott (Parson) on Dec 07, 2000 at 00:20 UTC | |
by marius (Hermit) on Dec 07, 2000 at 01:02 UTC | |
by mirod (Canon) on Dec 07, 2000 at 01:11 UTC | |
by ashok (Sexton) on Dec 07, 2000 at 10:37 UTC | |
by lemming (Priest) on Dec 07, 2000 at 10:50 UTC | |
by kilinrax (Deacon) on Dec 07, 2000 at 16:53 UTC | |
Re: path is broken
by mirod (Canon) on Dec 07, 2000 at 00:07 UTC |
Back to
Seekers of Perl Wisdom