Just to make user, your example is 3 lines ? give an example of what you want the output to be for the first data line in your example
the reason I ask is in your sample the data is colon sep'ed. On Tue, Mar 22, 2011 at 1:32 PM, Rich Shepard <rshep...@appl-ecosys.com> wrote: > I have a text file whose rows are formatted like this: > > BC-2:2009-02-15:Flow:150.00:ft/sec:Temperature (field):7.40:oF:Conductance, > Specific:2058.00:umhos/cm:pH:7.40:Std Units > BC-2:2009-05-15:Flow::ft/sec:Temperature (field):10.10:oF:Conductance, > Specific:1224.00:umhos/cm:pH:8.14:Std Units > BC-3:2009-02-15:Flow:326.00:ft/sec:Temperature (field):7.80:oF:Conductance, > Specific:576.50:umhos/cm:pH:7.40:Std Units > > and I need to have them split into multiple rows. Each row would have field > #1, a colon separator, field #2, a colon separator, then the parameter name, > measured value, and units. A job for awk! > > Unfortunately, despite my referring to the ORA sed & awk book, my attempts > to write a one-line script that uses a newline '\n' to split the lines > throws an error. The script: > > # This script takes spreadsheet exports from single lines per location/data to > # one line per location, date, and parameter. > > FS=":" > > {print > $1':'$2':'$3':'$4':'$5\n$1':'$2':'$6':'$7':'$8\n$1':'$2':'$9':'$10':'$11\n$1':'$2':'$12':'$13':'$14} > > produces this error message: > > awk: reform.awk:6: {print > $1':'$2':'$3':'$4':'$5\n$1':'$2':'$6':'$7':'$8\n$1':'$2':'$9':'$10':'$11\n$1':'$2':'$12':'$13':'$14} > awk: reform.awk:6: ^ invalid char ''' in expression > > I'm sure the caret will be mis-aligned when you read this. > > Please tell me what I've missed. > > Rich > _______________________________________________ > PLUG mailing list > PLUG@lists.pdxlinux.org > http://lists.pdxlinux.org/mailman/listinfo/plug > _______________________________________________ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug