This question already has an answer here:
- concatenate n lines with sed 2 answers
I am stuck on this.
i have an input file that looks like
16:20:03 Buy DRIP AMEX 500 13,51 USD 16:05:10 Sell SQ NYSE 100 36,32 USD 15:48:52 Sell NXTD Nasdaq 500 4,99 USD 15:48:52 Sell NXTD Nasdaq 500 4,99 USD 15:46:07 Buy SOXL AMEX 50 147,7209 USD 15:40:20 Buy TEUM AMEX 1 700 1,36 USD 15:40:19 Buy TEUM AMEX 300 1,36 USD
my goal is to get each four-line record onto one line, e.g.
16:20:03 Buy DRIP AMEX 500 13,51 USD 16:05:10 Sell SQ NYSE 100 36,32 USD
I know that each record is four lines. i also know that each record starts with (is separated by) a time on format hh:mm:ss
I have tried various awk commands specifying RS/FS OFS/ORS I have tried different variants of sed like
sed 'N;N;s/\n/ /'
The awk prints first record only. The sed doesn't manage to get all elements on same line
I can post more specific examples of what i have tried. It looks reallly simply. anyone who can give me a hint?
If you know an easier solution in another language, feel free to elaborate