Hi,
I have data in the following format:
data1 data2 data3 data4 data5 data6 data7 data8 data9 data10
I require the final output to be:
data1 data1 data1 data1
i only require the 1st line but I need to replicate it in n rows where n is the number of rows where data exists. In this example, there are 4 rows of data(excluding data1), so I need to replicate data1 in 4 rows.
I have a bash solution here. Not PHP.
#! /bin/sh LINE=$(sed -e '1,1p' INPUTFILE) sed -e '2,s/.*/$LINE/' INPUTFILE > OUTPUTFILE mv OUTPUTFILE INPUTFILE
Vino
gnu sed:
sed -n '1h;1!{g;p}'
I tried with this:
sed '1h;g' $file > $TMP/field.A
and it seems ok.
May I know what is the difference with
?
the difference is the number of rows.