[Gllug] Processing characters in a file
Russell Howe
rhowe at siksai.co.uk
Wed Jan 25 01:34:58 UTC 2006
On Tue, Jan 24, 2006 at 12:18:03AM +0000, Matthias Stingelin wrote:
> Hi,
>
> I need to process a file containing comma delimited integers with line breaks
> and { } brackets scattered at random through the file. I wish to remove all
> line breaks and brackets from the file and to then place new line breaks at
> fixed interval (say every 100 integer). Is sed the tool you would use? any
> hints welcome.
I think this is how I'd do it:
pipe to:
tr -d '{}\n'|sed -e 's/,\+/,/g' -e 's/\(\([0-9]\+,\)\{,100\}\)/\1\r\n/g'
You probably want to add a trailing ',' to your dataset and remove it at
the end.
--
Russell Howe | Why be just another cog in the machine,
rhowe at siksai.co.uk | when you can be the spanner in the works?
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list