I need a way of joining lines contained in a text file. I've seen numerous SED and AWK examples and none of them seem to be working for me.
The text file has 4 lines:
DELL1427
DOC
30189342
79
Now bear with me on this one as I'm actually scripting in a batch file using the ported versions of awk and sed (and other unix utils) for Windows.
I've use all these lines (not at the same time) with no luck:
awk "BEGIN {x = 0} {if (x<2) {printf("%s ",$0)x=x+1} if (x==2) {printf("\n")x = 0} }" %OUTPUT% > %OUTPUT2%
type %OUTPUT% | awk "BEGIN {FS="|";FLDmax=10;}{while (NF < FLDmax || $0 ~ /\|\"$/) {getline record;$0 = $0 record}print $0}" > %OUTPUT3%
sed "{N;N;/s/\n/ /g}" %OUTPUT% > %OUTPUT2%
sed "$!N;s/\n/ /" %OUTPUT% > %OUTPUT2%
sed -e :a -e N -e "s/\n/ /" -e ta %OUTPUT% > %OUTPUT2%
type %OUTPUT% | tr -d "\n" > %OUTPUT2%
In some cases, the output file has been changed to include spaces at the beginning of each line, other times, it hasn't made any changes to the file - and the complex awk commands don't seem to work at all.