[opensuse] Another awk question
All, I have a data file with variable number of fields per line. I only need to process (change) the first 2 fields, then I want to print the rest of the line the way it was. Is there a way I can say "print $3 - $NF" or something similar. I do need the Field separator inserted between fields. Thanks Greg -- Greg Freemyer Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, Jun 24, 2008 at 5:44 PM, Greg Freemyer
All,
I have a data file with variable number of fields per line.
I only need to process (change) the first 2 fields, then I want to print the rest of the line the way it was.
Is there a way I can say "print $3 - $NF" or something similar.
I do need the Field separator inserted between fields.
Something like: awk '{sub($1,$1";"); sub($2,$2";");print}' ./datafile ?
Thanks Greg
-- Best regards, Florian Schäfer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Tue, Jun 24, 2008 at 12:40 PM, Florian Schäfer
On Tue, Jun 24, 2008 at 5:44 PM, Greg Freemyer
wrote: All,
I have a data file with variable number of fields per line.
I only need to process (change) the first 2 fields, then I want to print the rest of the line the way it was.
Is there a way I can say "print $3 - $NF" or something similar.
I do need the Field separator inserted between fields.
Something like:
awk '{sub($1,$1";"); sub($2,$2";");print}' ./datafile
?
Not the way I was thinking of it, but it does the job perfectly. Thanks Greg -- Greg Freemyer Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Florian Schäfer
-
Greg Freemyer