Welcome to the most active Linux Forum on the web.
 LinuxQuestions.org PERL editing single line in file with regex
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 04-14-2004, 09:18 AM #1 indiescene LQ Newbie   Registered: Apr 2004 Posts: 4 Rep: PERL editing single line in file with regex Hi all, I am having some trouble in altering this bit of codeL Code: while () { ($hash,$input, $for,$aa) = split( /\s+/, $_) if /^\# \input\b.*/; if ($aa =~ /LEU\b/) {s/ (.*)/$z3leu$z2leu $z1leu$1/} print; } Need to alter so that it only writes to the first line of values and not the second, which is the case here, FILE: # input for LEU 0.987 0.654 - write before these values what is stated in s//; 0.587 0.211 Thanks,

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post bpk Linux - Software 2 10-07-2005 05:16 AM rose_bud4201 Programming 4 06-22-2005 07:26 PM groverrajiv Linux - Newbie 4 05-26-2004 03:38 AM davi_cabral Linux - Software 1 10-29-2003 01:24 PM natso Linux - Security 2 05-28-2002 04:22 AM

LinuxQuestions.org

All times are GMT -5. The time now is 03:16 AM.