hello -

i have been using this command to modify flat files that list directory contents, replacing the permissions listing with carriage returns:

/usr/bin/awk '{gsub(/lrw......./,"\n"); print}'
it works fine *except* on flat files that have more than 199 records (awk's limit, it turns out).

any idea how to do this with perl so as to avoid any record amount limit?

thanks in advance! - j

here is a sample flat file (ugly, isn't it?):

lrwxr-xr-x 1 root sys 8 Mar 13 2003 ./FESC_ADOT/runtime -> 01.30.02 lr +wxr-xr-x 1 root sys 8 Jul 30 2001 ./FESC_Websphere/runtime -> 01.00.0 +1 lrwxr-xr-x 1 root sys 8 Nov 24 16:22 ./qmc/runtime -> 01.50.01 lrw +xr-xr-x 1 root sys 9 Jul 7 11:50 ./ADOT_WEB/runtime -> web.1.18A lrwx +r-xr-x 1 root sys 18 Aug 20 2001 ./POSLITE/runtime -> POS_OPLITE01.01 +.05 lrwxr-xr-x 1 root sys 18 Aug 21 2001 ./MHSLITE/runtime -> MHS_OPL +ITE01.00.01 lrwxr-xr-x 1 root sys 16 Apr 15 2002 ./VAC/runtime -> 01. +01.03.regular lrwxr-xr-x 1 root sys 20 Aug 21 2001 ./BBSSLITE/runtime + -> BBSS_OPLITER01.01.01 lrwxr-xr-x 1 root sys 10 Feb 12 2002 ./Talar +ian/runtime -> 5.5R5/11.0 lrwxr-xr-x 1 root sys 19 Aug 21 2001 ./FESC +LITE/runtime -> FESC_OPLITE01.01.01 lrwxr-xr-x 1 adot dba 8 Aug 23 20 +02 ./TALLITE/runtime -> 01.00.04 lrwxr-xr-x 1 root sys 4 May 23 2002 +./PTTPLITE/runtime -> test lrwxr-xr-x 1 root sys 8 Nov 24 16:15 ./per +l/runtime -> 01.20.04

update (broquaint): tidied up formatting + added <readmore> tag


In reply to awk/perl? by bigbossman72

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.