| Author |
Simple query how do I print a space after every second line or after a certain matc
|
|
|
| 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
| |
| Loki Harfagr 2005-05-03, 3:56 pm |
| Le 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 ""}'
| |
|
| Thanks 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"
| |
| Loki Harfagr 2005-05-06, 3:55 pm |
| Le 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 ""}'
| |
|
| Thanks 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"
|
|
|
|