Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extract lines from a file

Status
Not open for further replies.

OieL

MIS
Sep 6, 2002
17
0
0
US
Hi ,

I have a file that contains below. How can I extract the 1st line , 2nd line and put it in
variables .... also the remaining lines after the 2 spaces should be put to a variable.

1st line is not always "powered by" !!! .. 2nd line always have "http" ....

this are UUencoded files on 1 directory that was pack() 'ed and the first 4 lines was just added in it ...

thanks

Powered by Ruby


&B5!.1PT*
"&@H`
M````#4E(1%(```!8````'P@"````[*J=MP````1G04U!``#9`T+63Z$````@
M8TA230``;HP``'1H``#T)```A,\``&U?``#H;```/(L``!M8&[T[#0```^%)
M1$%4>)QB^+UI[2@"(H``8H"S9C(RC$`$]SY``#%0*Q2>EA=!T)D`'RHZ=+^-
IY1IY60@;R`!R:106``'$0*VT``P&quot;&quot;.->;@;$Z9LTU>9S<T$\`&quot;27B0H`
)(W.!)%`$R``*
M`AE`Q1`U<&\#Q8&&quot;P&&quot;%2$$,A'&quot;!4A!=<.V4AP5``-$J(&quot;!)`T@&quot;70F1NI$2
>?]3-&<@%,BY%A0(14.5.8P.@QSYVMP*E@&R@&quot;$0*
M8B#0!*`4<D``N1!CX38&quot;%<,54!(0``%$M8#X,;4/DC6`J1?H,HAG@'X#NAO(
M!@8-Q(<0#T/\`_$2))[A/H=['B*([$^XL9!T`0Q0>&quot;A3'A```43]%#$3G.R!
MKIP)SN%`GT.X0#8D%0#%7S=6PU7&quot;_0R4@B1RH&quot;#<!*P!`92&quot;JX&(4!X0``%H
MJ8,4`&`0!H+__W4'%L2[%+PD2&quot;!;ZA<0%>#HUEWPR$IB,8&quot;P,'V-0&quot;B6F;0I
M@=P@2&8AQ<Y-.8)X`HAJ`4%_!&quot;F)J&(4,!```F@(!P1RS4IY0``$T!`.&quot;&quot;HB
M8&quot;``!!#Y`?$?-_AT__[-^?/7&!J0:N;3_?OAAFQV=*!G0``$$$T&quot;`@)^OG]/
G:E@,8$``!!`-`P(([J]?/U0&quot;`B&quot;`J!,0P(P`=#<0[4],`&quot;8$9&quot;D*
M`P)B['Q!`5H'!$``42<@SC0TP,6!;,R`P!0!>@\N`O0_9D!<ZN\'EC7(7(@:
M(`-KB@/&`5Q\9V``J0$!$$!4#@A@H?#F_'FX.)!-=D!@`DA8+%-40!:$)Q9@
MH$!$@$F2C!0!$$&quot;T+2/@,4->0`!]#O<>!`!#`=G/6*V`IQV2`@(@@&@5$,!H
M`:95K(J)#`AX*D,6A)B)K!=8/`%%@,$!%R&CV@8&`D``42<@@)D9.3_#74Q)
M0,!K#>1&quot;!QXZ<.L@&0$8'!`N/#.2&A```43-,@+N&LRPH'I`(!>-P&quot;0`KZJ.
M%1:0%Q```43-@`&quot;66VAU)R1+HRF&%&]`%^,/&quot;'@X(I<(<$%DNY&quot;+9_(J6F`@
M``00E6L-Y(A&quot;]B&:(+`\0PXRK`$!5`#,^<CAA1RR,U'K40@@M?V&'!```43]
M=@1R_/R'I7&quot;TPA_B3_P!@0D@Y2(<H=6C_TEO/B`'!$``43\@D#/_?UCIA9R-
M_\.Z(?@#`BUQ`<W!3/;(X4M&\P$Y(``&quot;B/R`@#1^(0@YQ:))P1O(0!*8SH%!
M!O0A1`2N`%[A`1EP04B<0[3@BFKDW$%&\P$Y(``&quot;:.B-1P!#!QB4F/T:M,@@
M-2```FA(!@1F\0'/7&0'!$``46VFBYX(+12P%A\DA0(0`030D)S[!.8+8,$!
F0637%,BA`$0``81@C7`$$&```JBGQ_Q.CI@`````245.1*Y&quot;8((`
 
something like this should get you going

open(F,&quot;file.whatever&quot;) || die &quot;error: $!\n&quot;;

$first_line = <F>;
$second_line = <F>;

while(<F>){
$rest_of_file .= $_;
}
Mike

&quot;Experience is the comb that Nature gives us, after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top