Skip to main content
Improve formatting, remove unrelated tag (python was not mandated in the body)
Source Link
AdminBee
  • 23.6k
  • 25
  • 55
  • 77

How to convert a string with hidden characters to a normal string

is thereDoes anyone hashave an idea abouton how to remove hidden characters from a string in the shell. this is an exemple :

#echo $a;
[root@localhost ~]#

but when i showw hidden characters :

#echo $a | cat -v
[root@localhost ~]# ls ^H^[[K^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[Kls^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[K

i want to delete hidden characters to have this output?

#echo $a | cat -v
[root@localhost ~]#
  • This is an example :

    # echo $a;
    [root@localhost ~]#
    
  • But when I "force" display of hidden characters it looks like this:

    # echo $a | cat -v
    [root@localhost ~]# ls ^H^[[K^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[Kls^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[K
    
  • I want to delete hidden characters to have this output:

    # echo $a | cat -v
    [root@localhost ~]#
    

convert string with hidden characters to normal string

is there anyone has an idea about how to remove hidden characters from a string in shell. this is an exemple :

#echo $a;
[root@localhost ~]#

but when i showw hidden characters :

#echo $a | cat -v
[root@localhost ~]# ls ^H^[[K^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[Kls^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[K

i want to delete hidden characters to have this output

#echo $a | cat -v
[root@localhost ~]#

How to convert a string with hidden characters to a normal string

Does anyone have an idea on how to remove hidden characters from a string in the shell?

  • This is an example :

    # echo $a;
    [root@localhost ~]#
    
  • But when I "force" display of hidden characters it looks like this:

    # echo $a | cat -v
    [root@localhost ~]# ls ^H^[[K^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[Kls^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[K
    
  • I want to delete hidden characters to have this output:

    # echo $a | cat -v
    [root@localhost ~]#
    
Post Closed as "Duplicate" by Chris Davies linux
Bumped by Community user
Source Link

convert string with hidden characters to normal string

is there anyone has an idea about how to remove hidden characters from a string in shell. this is an exemple :

#echo $a;
[root@localhost ~]#

but when i showw hidden characters :

#echo $a | cat -v
[root@localhost ~]# ls ^H^[[K^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[Kls^H^[[K^H^[[Kpwd^H^[[K^H^[[K^H^[[K

i want to delete hidden characters to have this output

#echo $a | cat -v
[root@localhost ~]#