Impossible to remove ^I ending from a text file

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a text file with this ending:



line1^I$^M$
line2^I$^M$
line3^I$^M$


I have trying many options I found in the web by using sed command and even 'dos2unix' but they only work to remove the ^M$ but not ^I. So my file is now like this:



line1^I$
line2^I$
line3^I$


I have scrutinized in the web but there is nothing about ^I. What exactly does it mean?







share|improve this question















  • 1




    ^I is a literal tab character.
    – DopeGhoti
    Jun 14 at 21:21










  • How are you producing that output? If it's cat -A, how do you have 2 line ending $ chars in the output?
    – glenn jackman
    Jun 15 at 13:39










  • A note to readers, use printf "line%dtrn" 1 2 3 > file to create this file.
    – glenn jackman
    Jun 15 at 13:39














up vote
1
down vote

favorite












I have a text file with this ending:



line1^I$^M$
line2^I$^M$
line3^I$^M$


I have trying many options I found in the web by using sed command and even 'dos2unix' but they only work to remove the ^M$ but not ^I. So my file is now like this:



line1^I$
line2^I$
line3^I$


I have scrutinized in the web but there is nothing about ^I. What exactly does it mean?







share|improve this question















  • 1




    ^I is a literal tab character.
    – DopeGhoti
    Jun 14 at 21:21










  • How are you producing that output? If it's cat -A, how do you have 2 line ending $ chars in the output?
    – glenn jackman
    Jun 15 at 13:39










  • A note to readers, use printf "line%dtrn" 1 2 3 > file to create this file.
    – glenn jackman
    Jun 15 at 13:39












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have a text file with this ending:



line1^I$^M$
line2^I$^M$
line3^I$^M$


I have trying many options I found in the web by using sed command and even 'dos2unix' but they only work to remove the ^M$ but not ^I. So my file is now like this:



line1^I$
line2^I$
line3^I$


I have scrutinized in the web but there is nothing about ^I. What exactly does it mean?







share|improve this question











I have a text file with this ending:



line1^I$^M$
line2^I$^M$
line3^I$^M$


I have trying many options I found in the web by using sed command and even 'dos2unix' but they only work to remove the ^M$ but not ^I. So my file is now like this:



line1^I$
line2^I$
line3^I$


I have scrutinized in the web but there is nothing about ^I. What exactly does it mean?









share|improve this question










share|improve this question




share|improve this question









asked Jun 14 at 21:18









Fersal

424




424







  • 1




    ^I is a literal tab character.
    – DopeGhoti
    Jun 14 at 21:21










  • How are you producing that output? If it's cat -A, how do you have 2 line ending $ chars in the output?
    – glenn jackman
    Jun 15 at 13:39










  • A note to readers, use printf "line%dtrn" 1 2 3 > file to create this file.
    – glenn jackman
    Jun 15 at 13:39












  • 1




    ^I is a literal tab character.
    – DopeGhoti
    Jun 14 at 21:21










  • How are you producing that output? If it's cat -A, how do you have 2 line ending $ chars in the output?
    – glenn jackman
    Jun 15 at 13:39










  • A note to readers, use printf "line%dtrn" 1 2 3 > file to create this file.
    – glenn jackman
    Jun 15 at 13:39







1




1




^I is a literal tab character.
– DopeGhoti
Jun 14 at 21:21




^I is a literal tab character.
– DopeGhoti
Jun 14 at 21:21












How are you producing that output? If it's cat -A, how do you have 2 line ending $ chars in the output?
– glenn jackman
Jun 15 at 13:39




How are you producing that output? If it's cat -A, how do you have 2 line ending $ chars in the output?
– glenn jackman
Jun 15 at 13:39












A note to readers, use printf "line%dtrn" 1 2 3 > file to create this file.
– glenn jackman
Jun 15 at 13:39




A note to readers, use printf "line%dtrn" 1 2 3 > file to create this file.
– glenn jackman
Jun 15 at 13:39










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










So your file will look like this using od or cat -A



$ od -c foo
0000000 l i n e 1 t n l i n e 2 t n l i
0000020 n e 3 t n
0000025
$ cat -A foo
line1^I$
line2^I$
line3^I$
$


To strip all ^I (Tab) characters, you could use sed -i 's/t//g' foo. To only strip tabs at the end of a line, used sed -i 's/t$//' foo



$ sed -i 's/t//g' foo
$ od -c foo
0000000 l i n e 1 n l i n e 2 n l i n e
0000020 3 n
0000022
$ cat -A foo
line1$
line2$
line3$
$





share|improve this answer



















  • 2




    To my knowledge, t for TAB is only supported by GNU sed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
    – Philippos
    Jun 15 at 8:23

















up vote
0
down vote













^I is probably not indicating a caret followed by an I, but rather is a representation of the character composed by pressing Ctrl+I. This character actually has a shortcut on most keyboards, to wit Tab. If you were to cat the file, you would probably see something like:



line1 $
line2 $
line3 $


Unless, that is, whatever you're using that is displaying literal ^Is is also showing the end of the line with a visible $.



You can use tr to eliminate them if you like, though:



$ cat file | tr -d 't'


t in this case is a magic sequence that is an easy way to represent a Tab character in several common tools (including, helpfully, tr).



dos2unix did nothing to the Tabs because they are identical between all the platforms that tool is used to "translate" to and from.






share|improve this answer























  • Thanks for your answer, I have tried cat file | tr -d 't' but the ^I is still there, I can see it when I use cat -A file.txt
    – Fersal
    Jun 14 at 21:46










  • That's because cat -A is what you use to make tabs and EOLs visible. The cat command will replace the contents of the file and display it to you. To make a new file without tabs, use cat file | tr -d 't' > newfile.
    – DopeGhoti
    Jun 14 at 21:48










  • Ooh! I got it, that is in the case to make a new file. I didn't know ^I is another form to represent a tab. Knowing that, now I have tried with sed as @steve suggested and it finally gone. Thanks
    – Fersal
    Jun 14 at 22:02










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449898%2fimpossible-to-remove-i-ending-from-a-text-file%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










So your file will look like this using od or cat -A



$ od -c foo
0000000 l i n e 1 t n l i n e 2 t n l i
0000020 n e 3 t n
0000025
$ cat -A foo
line1^I$
line2^I$
line3^I$
$


To strip all ^I (Tab) characters, you could use sed -i 's/t//g' foo. To only strip tabs at the end of a line, used sed -i 's/t$//' foo



$ sed -i 's/t//g' foo
$ od -c foo
0000000 l i n e 1 n l i n e 2 n l i n e
0000020 3 n
0000022
$ cat -A foo
line1$
line2$
line3$
$





share|improve this answer



















  • 2




    To my knowledge, t for TAB is only supported by GNU sed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
    – Philippos
    Jun 15 at 8:23














up vote
2
down vote



accepted










So your file will look like this using od or cat -A



$ od -c foo
0000000 l i n e 1 t n l i n e 2 t n l i
0000020 n e 3 t n
0000025
$ cat -A foo
line1^I$
line2^I$
line3^I$
$


To strip all ^I (Tab) characters, you could use sed -i 's/t//g' foo. To only strip tabs at the end of a line, used sed -i 's/t$//' foo



$ sed -i 's/t//g' foo
$ od -c foo
0000000 l i n e 1 n l i n e 2 n l i n e
0000020 3 n
0000022
$ cat -A foo
line1$
line2$
line3$
$





share|improve this answer



















  • 2




    To my knowledge, t for TAB is only supported by GNU sed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
    – Philippos
    Jun 15 at 8:23












up vote
2
down vote



accepted







up vote
2
down vote



accepted






So your file will look like this using od or cat -A



$ od -c foo
0000000 l i n e 1 t n l i n e 2 t n l i
0000020 n e 3 t n
0000025
$ cat -A foo
line1^I$
line2^I$
line3^I$
$


To strip all ^I (Tab) characters, you could use sed -i 's/t//g' foo. To only strip tabs at the end of a line, used sed -i 's/t$//' foo



$ sed -i 's/t//g' foo
$ od -c foo
0000000 l i n e 1 n l i n e 2 n l i n e
0000020 3 n
0000022
$ cat -A foo
line1$
line2$
line3$
$





share|improve this answer















So your file will look like this using od or cat -A



$ od -c foo
0000000 l i n e 1 t n l i n e 2 t n l i
0000020 n e 3 t n
0000025
$ cat -A foo
line1^I$
line2^I$
line3^I$
$


To strip all ^I (Tab) characters, you could use sed -i 's/t//g' foo. To only strip tabs at the end of a line, used sed -i 's/t$//' foo



$ sed -i 's/t//g' foo
$ od -c foo
0000000 l i n e 1 n l i n e 2 n l i n e
0000020 3 n
0000022
$ cat -A foo
line1$
line2$
line3$
$






share|improve this answer















share|improve this answer



share|improve this answer








edited Jun 14 at 21:52


























answered Jun 14 at 21:46









steve

12.1k22047




12.1k22047







  • 2




    To my knowledge, t for TAB is only supported by GNU sed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
    – Philippos
    Jun 15 at 8:23












  • 2




    To my knowledge, t for TAB is only supported by GNU sed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
    – Philippos
    Jun 15 at 8:23







2




2




To my knowledge, t for TAB is only supported by GNU sed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
– Philippos
Jun 15 at 8:23




To my knowledge, t for TAB is only supported by GNU sed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
– Philippos
Jun 15 at 8:23












up vote
0
down vote













^I is probably not indicating a caret followed by an I, but rather is a representation of the character composed by pressing Ctrl+I. This character actually has a shortcut on most keyboards, to wit Tab. If you were to cat the file, you would probably see something like:



line1 $
line2 $
line3 $


Unless, that is, whatever you're using that is displaying literal ^Is is also showing the end of the line with a visible $.



You can use tr to eliminate them if you like, though:



$ cat file | tr -d 't'


t in this case is a magic sequence that is an easy way to represent a Tab character in several common tools (including, helpfully, tr).



dos2unix did nothing to the Tabs because they are identical between all the platforms that tool is used to "translate" to and from.






share|improve this answer























  • Thanks for your answer, I have tried cat file | tr -d 't' but the ^I is still there, I can see it when I use cat -A file.txt
    – Fersal
    Jun 14 at 21:46










  • That's because cat -A is what you use to make tabs and EOLs visible. The cat command will replace the contents of the file and display it to you. To make a new file without tabs, use cat file | tr -d 't' > newfile.
    – DopeGhoti
    Jun 14 at 21:48










  • Ooh! I got it, that is in the case to make a new file. I didn't know ^I is another form to represent a tab. Knowing that, now I have tried with sed as @steve suggested and it finally gone. Thanks
    – Fersal
    Jun 14 at 22:02














up vote
0
down vote













^I is probably not indicating a caret followed by an I, but rather is a representation of the character composed by pressing Ctrl+I. This character actually has a shortcut on most keyboards, to wit Tab. If you were to cat the file, you would probably see something like:



line1 $
line2 $
line3 $


Unless, that is, whatever you're using that is displaying literal ^Is is also showing the end of the line with a visible $.



You can use tr to eliminate them if you like, though:



$ cat file | tr -d 't'


t in this case is a magic sequence that is an easy way to represent a Tab character in several common tools (including, helpfully, tr).



dos2unix did nothing to the Tabs because they are identical between all the platforms that tool is used to "translate" to and from.






share|improve this answer























  • Thanks for your answer, I have tried cat file | tr -d 't' but the ^I is still there, I can see it when I use cat -A file.txt
    – Fersal
    Jun 14 at 21:46










  • That's because cat -A is what you use to make tabs and EOLs visible. The cat command will replace the contents of the file and display it to you. To make a new file without tabs, use cat file | tr -d 't' > newfile.
    – DopeGhoti
    Jun 14 at 21:48










  • Ooh! I got it, that is in the case to make a new file. I didn't know ^I is another form to represent a tab. Knowing that, now I have tried with sed as @steve suggested and it finally gone. Thanks
    – Fersal
    Jun 14 at 22:02












up vote
0
down vote










up vote
0
down vote









^I is probably not indicating a caret followed by an I, but rather is a representation of the character composed by pressing Ctrl+I. This character actually has a shortcut on most keyboards, to wit Tab. If you were to cat the file, you would probably see something like:



line1 $
line2 $
line3 $


Unless, that is, whatever you're using that is displaying literal ^Is is also showing the end of the line with a visible $.



You can use tr to eliminate them if you like, though:



$ cat file | tr -d 't'


t in this case is a magic sequence that is an easy way to represent a Tab character in several common tools (including, helpfully, tr).



dos2unix did nothing to the Tabs because they are identical between all the platforms that tool is used to "translate" to and from.






share|improve this answer















^I is probably not indicating a caret followed by an I, but rather is a representation of the character composed by pressing Ctrl+I. This character actually has a shortcut on most keyboards, to wit Tab. If you were to cat the file, you would probably see something like:



line1 $
line2 $
line3 $


Unless, that is, whatever you're using that is displaying literal ^Is is also showing the end of the line with a visible $.



You can use tr to eliminate them if you like, though:



$ cat file | tr -d 't'


t in this case is a magic sequence that is an easy way to represent a Tab character in several common tools (including, helpfully, tr).



dos2unix did nothing to the Tabs because they are identical between all the platforms that tool is used to "translate" to and from.







share|improve this answer















share|improve this answer



share|improve this answer








edited Jun 14 at 21:44


























answered Jun 14 at 21:28









DopeGhoti

39.8k54779




39.8k54779











  • Thanks for your answer, I have tried cat file | tr -d 't' but the ^I is still there, I can see it when I use cat -A file.txt
    – Fersal
    Jun 14 at 21:46










  • That's because cat -A is what you use to make tabs and EOLs visible. The cat command will replace the contents of the file and display it to you. To make a new file without tabs, use cat file | tr -d 't' > newfile.
    – DopeGhoti
    Jun 14 at 21:48










  • Ooh! I got it, that is in the case to make a new file. I didn't know ^I is another form to represent a tab. Knowing that, now I have tried with sed as @steve suggested and it finally gone. Thanks
    – Fersal
    Jun 14 at 22:02
















  • Thanks for your answer, I have tried cat file | tr -d 't' but the ^I is still there, I can see it when I use cat -A file.txt
    – Fersal
    Jun 14 at 21:46










  • That's because cat -A is what you use to make tabs and EOLs visible. The cat command will replace the contents of the file and display it to you. To make a new file without tabs, use cat file | tr -d 't' > newfile.
    – DopeGhoti
    Jun 14 at 21:48










  • Ooh! I got it, that is in the case to make a new file. I didn't know ^I is another form to represent a tab. Knowing that, now I have tried with sed as @steve suggested and it finally gone. Thanks
    – Fersal
    Jun 14 at 22:02















Thanks for your answer, I have tried cat file | tr -d 't' but the ^I is still there, I can see it when I use cat -A file.txt
– Fersal
Jun 14 at 21:46




Thanks for your answer, I have tried cat file | tr -d 't' but the ^I is still there, I can see it when I use cat -A file.txt
– Fersal
Jun 14 at 21:46












That's because cat -A is what you use to make tabs and EOLs visible. The cat command will replace the contents of the file and display it to you. To make a new file without tabs, use cat file | tr -d 't' > newfile.
– DopeGhoti
Jun 14 at 21:48




That's because cat -A is what you use to make tabs and EOLs visible. The cat command will replace the contents of the file and display it to you. To make a new file without tabs, use cat file | tr -d 't' > newfile.
– DopeGhoti
Jun 14 at 21:48












Ooh! I got it, that is in the case to make a new file. I didn't know ^I is another form to represent a tab. Knowing that, now I have tried with sed as @steve suggested and it finally gone. Thanks
– Fersal
Jun 14 at 22:02




Ooh! I got it, that is in the case to make a new file. I didn't know ^I is another form to represent a tab. Knowing that, now I have tried with sed as @steve suggested and it finally gone. Thanks
– Fersal
Jun 14 at 22:02












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449898%2fimpossible-to-remove-i-ending-from-a-text-file%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)