satyam <dirac....@gmail.com> writes: > I have a text file like this > > A1980JE39300007 2732 4195 12.527000 > A1980JE39300007 3465 9720 22.000000 > A1980JE39300007 2732 9720 18.000000 > A1980KK18700010 130 303 4.985000 > A1980KK18700010 7 4915 0.435000 [...] > I want to split the file and get multiple files like > A1980JE39300007.txt and A1980KK18700010.txt, where each file will > contain column2, 3 and 4.
Sorry for being completely off-topic here, but awk has a very convenient feature to deal with this. Simply use: awk '{ print $2,$3,$4 > $1".txt"; }' /path/to/your/file -- Alain. -- http://mail.python.org/mailman/listinfo/python-list