I have a bash script where I do some filtering with the
sed command and then pipe the result to
gzip to zip the output again. The filtered output has the format
<id>,<title>,<bool (0 or 1)>. I would like to print the id but with a trailing carriage return instead of a newline so that they all are printed over each other, since the id is increasing. My approach was something like:
<chained sed commands> \ | tee >(sed -re "s/^([0-9]+).*/\1\r/") | gzip -c > outputfile.gz
This does however add a newline on every line and does not produce the desired outcome of only printing on one line.