Mailinglist Archive: opensuse (3625 mails)

< Previous Next >
Re: [opensuse] Another awk question
  • From: "Florian Schäfer" <florian.schaefer@xxxxxxxxx>
  • Date: Tue, 24 Jun 2008 18:40:14 +0200
  • Message-id: <a22988090806240940j426d4355u1f530ef997b0b410@xxxxxxxxxxxxxx>
On Tue, Jun 24, 2008 at 5:44 PM, Greg Freemyer <greg.freemyer@xxxxxxxxx> wrote:

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



Best regards,
Florian Schäfer
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups