September 13, 2010 1

Remove brackets from file

By in OpenFOAM

Removing brackets from a huge datafile can be done in multiple ways, but from my point of view, using the unix command sed and regular expressions is the fastest and easiest way to do that.

sed -e "s/[(,)]//g" $file > output

This comes in handy, if you need to plot data, that is located on a cluster or server and you do not want to transfer a 50MB file over the net just for plotting purposes.

Tags: , , , ,

One Response to “Remove brackets from file”

  1. [...] brackes. They need to be removed for the plotting, which can be done in several ways and I am using sed. But one question comes up to mind: What if I do not want to execute a load 'plot.gnp' each time, I [...]

Leave a Reply