Skip to main content
Commonmark migration
Source Link

Possible Duplicate:
Removing control chars (including console codes / colours) from script output

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

Update:

###Update: LookingLooking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

Update 2:

###Update 2: AfterAfter user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

Possible Duplicate:
Removing control chars (including console codes / colours) from script output

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

###Update: Looking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

###Update 2: After user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

Possible Duplicate:
Removing control chars (including console codes / colours) from script output

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

Update:

Looking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

Update 2:

After user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

Possible Duplicate:
Removing control chars (including console codes / colours) from script outputRemoving control chars (including console codes / colours) from script output

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to filehow to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

###Update: Looking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

###Update 2: After user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

Possible Duplicate:
Removing control chars (including console codes / colours) from script output

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

###Update: Looking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

###Update 2: After user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

Possible Duplicate:
Removing control chars (including console codes / colours) from script output

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

###Update: Looking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

###Update 2: After user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

insert duplicate link
Source Link

Possible Duplicate:
Removing control chars (including console codes / colours) from script output

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

###Update: Looking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

###Update 2: After user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

###Update: Looking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

###Update 2: After user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

Possible Duplicate:
Removing control chars (including console codes / colours) from script output

How do I disable all color codes when redirecting to file?

I previously asked how to redirect everything to file, now I want to know how to redirect without colors.

So instead of:

^[(B^[[m^[[1m^[[31m:: ^[(B^[[m^[[1mDaemon script ^[(B^[[m^[[1m^[[31mntpd^[(B^[[m^[[1m does not exist or is not executable.^[(B^[[m

I'm looking forward to achieve plain:

:: Daemon script ntpd does not exist or is not executable.

###Update: Looking at jw013 provided link, I tried the sed approach:

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

But it didn't even redirect, and simply displayed the colored output to the console.

###Update 2: After user1146332 comment, in order to pipe STDERR, I have to pipe with |&.

rc.d restart ntpd | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" &> progress.txt

Resulted in:

^[(B:: ^[(BDaemon script ^[(Bntpd^[(B does not exist or is not executable.^[(B

It's tidier, but still some codes remain. But that sed RegExp is too hard for me to decypher.

updated
Source Link
tomsseisums
  • 427
  • 1
  • 5
  • 13
Loading
grammar fix
Source Link
daisy
  • 55.9k
  • 80
  • 253
  • 402
Loading
added 250 characters in body
Source Link
tomsseisums
  • 427
  • 1
  • 5
  • 13
Loading
added 2 characters in body
Source Link
Thor
  • 17.5k
  • 3
  • 55
  • 71
Loading
deleted 1 characters in body
Source Link
tomsseisums
  • 427
  • 1
  • 5
  • 13
Loading
Source Link
tomsseisums
  • 427
  • 1
  • 5
  • 13
Loading