I am trying to write a bash script
Node.js code outputs to terminal and logs to file as well
I need to remove everything between '[Progress]' and this emoji '' while writing to file but should print in terminal.
Works fine on mac if i open with an vscode or similar editor but on an ubuntu machine on vim it hows everything as if nothing changed all Progress and color codes are still there.
for the emoji I tried with an code this emoji I am using is \ud83d
here is my code
LOG_FILE='output.log'
node inddex.js 2>&1 \
| tee /dev/tty \
| sed -e $'s,\[Progress\].*,,g' -e $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' \
> $LOG_FILE
My node output is something like (for multiple single line)
[2K[1G[Progress]: Processing Records ...[2K[1G[Progress]: Processed Records: [33m816[0m [2K[1G[Progress]: Processed Records: [33m1725[0m [2K[1G[Progress]: Processed Records: [33m2774[0m [2K[1G[Progress]: Processed Records: [33m4041[0m [2K[1G[Progress]: Processed Records: [33m5207[0m [2K[1G[Progress]: Processed Records: [33m6557[0m [2K[1G[Progress]: Processed Records: [33m8590[0m [2K[1G[Progress]: Processed Records: [33m9811[0m [2K[1G Time taken to process [33m10000[0m records = [36m8.54 sec[0m
for above line I only need to process this to output file and display everything on terminal
Time taken to process 10000 records = 8.54 sec