LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 04-14-2004, 09:18 AM   #1
indiescene
LQ Newbie
 
Registered: Apr 2004
Posts: 4

Rep: Reputation: 0
PERL editing single line in file with regex


Hi all,

I am having some trouble in altering this bit of codeL
Code:
while (<FILE1>) {
($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,
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple file editing using... sed? perl? bpk Linux - Software 2 10-07-2005 05:16 AM
Retrieve only a single line from a file rose_bud4201 Programming 4 06-22-2005 07:26 PM
merge multiple lines of a single file into one line groverrajiv Linux - Newbie 4 05-26-2004 03:38 AM
reading a single line of a text file davi_cabral Linux - Software 1 10-29-2003 01:24 PM
HELP!! Problem editing the shadow file in Single user mode natso Linux - Security 2 05-28-2002 04:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration