Hi,
I am counting no. of lines in a file using cat like this on a unix system.
$line_count = `cat $filename | wc -l`
This works fine. But one of the files having a blank in int's path like this.
Module: /org/trans/program files/src/apptask1.c.
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/dir1/dir2/dir3/dir4/
dir5/apptask2.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
Ashok
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.