[K12OSN] script help please (OT)

Les Mikesell les at futuresource.com
Mon May 23 16:08:27 UTC 2005


On Mon, 2005-05-23 at 09:21, Jimmy Schwankl wrote:

> What he would like is for the first line to have the next three lines  
> appended to it with the first item stripped out so that when he  
> imports the file into a spreadsheet all the data for each record is  
> on one line.

Assuming that the first item is always numeric, this will read stdin
and write to stdout, so use <inputfile >outputfile for files.

#!/bin/sh
while read LINE1
do
 for num in 2 3 4
  do
  read IN
  eval LINE$num=`echo $IN |sed -es/^[0-9]*,//`
  done
 echo $LINE1,$LINE2,$LINE3,$LINE4
done

-- 
  Les Mikesell
   les at futuresource.com





More information about the K12OSN mailing list