i have been using this command to modify flat files that list directory contents, replacing the permissions listing with carriage returns:
it works fine *except* on flat files that have more than 199 records (awk's limit, it turns out)./usr/bin/awk '{gsub(/lrw......./,"\n"); print}'
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |