Code Comments
Programming Forum and web based access to our favorite programming groups.Below works for each line but I would like every second line a space.
awk '{print;print ""}' filname
What I would like is below:
start of day
end of day
start of day
end of day
Also I'd like to use a search critera as an option also ie search for say
start and then print next two lines and have a space ie same
as above output but using search. Something like below that does not work.
awk '/start/ {print;print ""}'
Thanks in advance
Sammy
Post Follow-up to this messageLe Tue, 03 May 2005 03:41:50 +0000, sammy a écrit_:
> Below works for each line but I would like every second line a space.
>
> awk '{print;print ""}' filname
>
> What I would like is below:
>
> start of day
> end of day
>
> start of day
> end of day
>
> Also I'd like to use a search critera as an option also ie search for say
> start and then print next two lines and have a space ie same
> as above output but using search. Something like below that does not work.
>
> awk '/start/ {print;print ""}'
Have a try starting whith this :
awk '{print};(NR%2==0) {print ""}'
Post Follow-up to this messageThanks for advice Sammy "Kenny McCormack" <gazelle@yin.interaccess.com> wrote in message news:d58klg$1vs$1@yin.interaccess.com... > In article <d58ig1$kot@netnews.proxy.lucent.com>, > Ed Morton <morton@lsupcaemnt.com> wrote: > ... > > ORS=NR%2?"\n":"\n\n"
Post Follow-up to this messageLe Tue, 03 May 2005 03:41:50 +0000, sammy a écrit_:
> Below works for each line but I would like every second line a space.
>
> awk '{print;print ""}' filname
>
> What I would like is below:
>
> start of day
> end of day
>
> start of day
> end of day
>
> Also I'd like to use a search critera as an option also ie search for say
> start and then print next two lines and have a space ie same
> as above output but using search. Something like below that does not work.
>
> awk '/start/ {print;print ""}'
Have a try starting whith this :
awk '{print};(NR%2==0) {print ""}'
Post Follow-up to this messageThanks for advice Sammy "Kenny McCormack" <gazelle@yin.interaccess.com> wrote in message news:d58klg$1vs$1@yin.interaccess.com... > In article <d58ig1$kot@netnews.proxy.lucent.com>, > Ed Morton <morton@lsupcaemnt.com> wrote: > ... > > ORS=NR%2?"\n":"\n\n"
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.