Re: [OT] simpliest way to process this data file
- From: Zhang Weiwu <zhangweiwu@xxxxxxxxxx>
- Date: Thu, 26 Apr 2007 14:51:29 +0800
An example that is probably not simple enough:
awk 'BEGIN { FS="\n"; RS="\n\n";} { print ""; print $NF; for (i=1; i<NF; i++) print $i;}'
On Thu, 2007-04-26 at 11:18 +0800, Zhang Weiwu wrote:
I know this is OT but we got so many sysops here and this might be--
something very easy for them to drop me a quick answer?
I have a data file formatted like this each block of data consist of
several lines; blocks are separated by empty lines like this
This is a
block
of data
with lines
and another block
of
data
The task is to move the last line of each block to the first line of the
block. So the processed data look like this:
with lines
This is a
block
of data
data
and other block
of
I have tried a lot reading info pages of sed still cannot figure out an
easy solution (tried to play with "N" command a lot of times). I know
how to do it in awk but I am pretty interested to learn a second
language and I really think sed or other tools should be able to handle
this:)
Zhang Weiwu
Real Softservice
http://www.realss.com
+86 592 2091112
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: [OT] simpliest way to process this data file
- From: Jonathan McKeown
- Re: [OT] simpliest way to process this data file
- References:
- [OT] simpliest way to process this data file
- From: Zhang Weiwu
- [OT] simpliest way to process this data file
- Prev by Date: Re: best programming language for console/sql application?
- Next by Date: Re: DHCP/NIC IP address contention issues
- Previous by thread: [OT] simpliest way to process this data file
- Next by thread: Re: [OT] simpliest way to process this data file
- Index(es):
Relevant Pages
|