Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: Print field...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 24 Topic 2212 of 2404
Post > Topic >>

Re: Print fields starting with N to the end of line.

by "Rajan" <svrajan@[EMAIL PROTECTED] > Mar 30, 2008 at 09:18 PM

"Luuk" <Luuk@[EMAIL PROTECTED]
> wrote in message 
news:3ve5c5-p27.ln1@[EMAIL PROTECTED]
> Peter schreef:
>> Hello, seems that I'm missing something obvious. There is file with
>> variable number of field, is there any simple way in awk to print
>> fields starting with field N up to the end of line. e.g.
>>
>> $ cat test.txt
>> a b c
>> a b c d
>> a b c d e f
>> a b c d v e
>>
>> How to print
>> $ awk <???> test.txt
>>
>> d
>> d e f
>> d v e
>>
>> Of course this is simplification of real data I have so I definitely
>> need awk to parse it ;) Thank you very much in advance.
>
> $ awk -v nr=4 '{ for (x=nr; x<=NF; x++) {
>           printf $x " "; }; print " " }'  test.txt
>
>
> -- 
> Luuk

One thing that we should note here is we will lose spacing between the 
fields this way.

Rajan
 




 24 Posts in Topic:
Print fields starting with N to the end of line.
Peter <volkov.peter@[E  2008-03-30 11:12:35 
Re: Print fields starting with N to the end of line.
pk <pk@[EMAIL PROTECTE  2008-03-30 20:47:04 
Re: Print fields starting with N to the end of line.
Ed Morton <morton@[EMA  2008-03-30 13:34:59 
Re: Print fields starting with N to the end of line.
"Rajan" <svr  2008-03-30 15:25:31 
Re: Print fields starting with N to the end of line.
Luuk <Luuk@[EMAIL PROT  2008-03-30 23:57:26 
Re: Print fields starting with N to the end of line.
"Rajan" <svr  2008-03-30 21:18:15 
Re: Print fields starting with N to the end of line.
Luuk <Luuk@[EMAIL PROT  2008-03-31 13:14:16 
Re: Print fields starting with N to the end of line.
pk <pk@[EMAIL PROTECTE  2008-03-31 13:48:17 
Re: Print fields starting with N to the end of line.
Luuk <Luuk@[EMAIL PROT  2008-03-31 14:01:48 
Re: Print fields starting with N to the end of line.
pk <pk@[EMAIL PROTECTE  2008-03-31 14:24:17 
Re: Print fields starting with N to the end of line.
Janis Papanagnou <Jani  2008-03-31 19:54:37 
Re: Print fields starting with N to the end of line.
Janis Papanagnou <Jani  2008-03-31 19:56:05 
Re: Print fields starting with N to the end of line.
pk <pk@[EMAIL PROTECTE  2008-04-01 09:48:02 
Re: Print fields starting with N to the end of line.
Ed Morton <morton@[EMA  2008-04-01 08:11:14 
Re: Print fields starting with N to the end of line.
Ed Morton <morton@[EMA  2008-03-31 07:03:39 
Re: Print fields starting with N to the end of line.
Luuk <Luuk@[EMAIL PROT  2008-03-31 14:10:01 
Re: Print fields starting with N to the end of line.
Ed Morton <morton@[EMA  2008-03-31 07:13:53 
Re: Print fields starting with N to the end of line.
Barry Fishman <barry_f  2008-03-31 13:45:27 
Re: Print fields starting with N to the end of line.
Ed Morton <morton@[EMA  2008-03-31 10:47:10 
Re: Print fields starting with N to the end of line.
pk <pk@[EMAIL PROTECTE  2008-03-31 18:15:35 
Re: Print fields starting with N to the end of line.
Ed Morton <morton@[EMA  2008-03-31 11:29:11 
Re: Print fields starting with N to the end of line.
Janis Papanagnou <Jani  2008-03-31 20:01:12 
Re: Print fields starting with N to the end of line.
Janis <janis_papanagno  2008-04-01 00:39:44 
Re: Print fields starting with N to the end of line.
pk <pk@[EMAIL PROTECTE  2008-04-01 10:11:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 14:38:57 CST 2008.