Impossible to remove ^I ending from a text file

Clash 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?
text-processing sed
add a comment |Â
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?
text-processing sed
1
^Iis a literal tab character.
â DopeGhoti
Jun 14 at 21:21
How are you producing that output? If it'scat -A, how do you have 2 line ending$chars in the output?
â glenn jackman
Jun 15 at 13:39
A note to readers, useprintf "line%dtrn" 1 2 3 > fileto create this file.
â glenn jackman
Jun 15 at 13:39
add a comment |Â
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?
text-processing sed
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?
text-processing sed
asked Jun 14 at 21:18
Fersal
424
424
1
^Iis a literal tab character.
â DopeGhoti
Jun 14 at 21:21
How are you producing that output? If it'scat -A, how do you have 2 line ending$chars in the output?
â glenn jackman
Jun 15 at 13:39
A note to readers, useprintf "line%dtrn" 1 2 3 > fileto create this file.
â glenn jackman
Jun 15 at 13:39
add a comment |Â
1
^Iis a literal tab character.
â DopeGhoti
Jun 14 at 21:21
How are you producing that output? If it'scat -A, how do you have 2 line ending$chars in the output?
â glenn jackman
Jun 15 at 13:39
A note to readers, useprintf "line%dtrn" 1 2 3 > fileto 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
add a comment |Â
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$
$
2
To my knowledge,tfor TAB is only supported by GNUsed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
â Philippos
Jun 15 at 8:23
add a comment |Â
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.
Thanks for your answer, I have triedcat file | tr -d 't'but the^Iis still there, I can see it when I usecat -A file.txt
â Fersal
Jun 14 at 21:46
That's becausecat -Ais what you use to make tabs and EOLs visible. Thecatcommand will replace the contents of the file and display it to you. To make a new file without tabs, usecat 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^Iis another form to represent a tab. Knowing that, now I have tried withsedas @steve suggested and it finally gone. Thanks
â Fersal
Jun 14 at 22:02
add a comment |Â
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$
$
2
To my knowledge,tfor TAB is only supported by GNUsed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
â Philippos
Jun 15 at 8:23
add a comment |Â
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$
$
2
To my knowledge,tfor TAB is only supported by GNUsed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
â Philippos
Jun 15 at 8:23
add a comment |Â
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$
$
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$
$
edited Jun 14 at 21:52
answered Jun 14 at 21:46
steve
12.1k22047
12.1k22047
2
To my knowledge,tfor TAB is only supported by GNUsed. Better use a literal tab instead (usually entered by preceeding it with ctrl-V). This should work anywhere.
â Philippos
Jun 15 at 8:23
add a comment |Â
2
To my knowledge,tfor TAB is only supported by GNUsed. 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
add a comment |Â
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.
Thanks for your answer, I have triedcat file | tr -d 't'but the^Iis still there, I can see it when I usecat -A file.txt
â Fersal
Jun 14 at 21:46
That's becausecat -Ais what you use to make tabs and EOLs visible. Thecatcommand will replace the contents of the file and display it to you. To make a new file without tabs, usecat 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^Iis another form to represent a tab. Knowing that, now I have tried withsedas @steve suggested and it finally gone. Thanks
â Fersal
Jun 14 at 22:02
add a comment |Â
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.
Thanks for your answer, I have triedcat file | tr -d 't'but the^Iis still there, I can see it when I usecat -A file.txt
â Fersal
Jun 14 at 21:46
That's becausecat -Ais what you use to make tabs and EOLs visible. Thecatcommand will replace the contents of the file and display it to you. To make a new file without tabs, usecat 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^Iis another form to represent a tab. Knowing that, now I have tried withsedas @steve suggested and it finally gone. Thanks
â Fersal
Jun 14 at 22:02
add a comment |Â
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.
^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.
edited Jun 14 at 21:44
answered Jun 14 at 21:28
DopeGhoti
39.8k54779
39.8k54779
Thanks for your answer, I have triedcat file | tr -d 't'but the^Iis still there, I can see it when I usecat -A file.txt
â Fersal
Jun 14 at 21:46
That's becausecat -Ais what you use to make tabs and EOLs visible. Thecatcommand will replace the contents of the file and display it to you. To make a new file without tabs, usecat 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^Iis another form to represent a tab. Knowing that, now I have tried withsedas @steve suggested and it finally gone. Thanks
â Fersal
Jun 14 at 22:02
add a comment |Â
Thanks for your answer, I have triedcat file | tr -d 't'but the^Iis still there, I can see it when I usecat -A file.txt
â Fersal
Jun 14 at 21:46
That's becausecat -Ais what you use to make tabs and EOLs visible. Thecatcommand will replace the contents of the file and display it to you. To make a new file without tabs, usecat 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^Iis another form to represent a tab. Knowing that, now I have tried withsedas @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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
^Iis 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 > fileto create this file.â glenn jackman
Jun 15 at 13:39