e******r 发帖数: 220 | 1 I tried "\t" to represent a tab, but it doesn't work. thanks
bash-2.02$ less withtab.txt
fsfsdfsd = dlkgjdl
djf = dfd
bash-2.02$ sed 's/\t/ /g' withtab.txt
fsfsdfsd = dlkgjdl
djf = dfd |
O******e 发帖数: 734 | 2 Ctrl-I
【在 e******r 的大作中提到】 : I tried "\t" to represent a tab, but it doesn't work. thanks : bash-2.02$ less withtab.txt : fsfsdfsd = dlkgjdl : djf = dfd : bash-2.02$ sed 's/\t/ /g' withtab.txt : fsfsdfsd = dlkgjdl : djf = dfd
|
e******r 发帖数: 220 | 3 what is that? ctrl followed by a char "l" as in "leg"?
【在 O******e 的大作中提到】 : Ctrl-I
|
o*o 发帖数: 404 | 4 are u sure you have tab in your file?
【在 e******r 的大作中提到】 : I tried "\t" to represent a tab, but it doesn't work. thanks : bash-2.02$ less withtab.txt : fsfsdfsd = dlkgjdl : djf = dfd : bash-2.02$ sed 's/\t/ /g' withtab.txt : fsfsdfsd = dlkgjdl : djf = dfd
|
e******r 发帖数: 220 | 5 yes, I artificially put some tabs in file for testing this.
【在 o*o 的大作中提到】 : are u sure you have tab in your file?
|
o*o 发帖数: 404 | 6 so, it's RP problem.
【在 e******r 的大作中提到】 : yes, I artificially put some tabs in file for testing this.
|
e*****w 发帖数: 144 | 7 you need to escape \ with \\ ba.
【在 e******r 的大作中提到】 : I tried "\t" to represent a tab, but it doesn't work. thanks : bash-2.02$ less withtab.txt : fsfsdfsd = dlkgjdl : djf = dfd : bash-2.02$ sed 's/\t/ /g' withtab.txt : fsfsdfsd = dlkgjdl : djf = dfd
|
O******e 发帖数: 734 | 8 Control-EYE.
【在 e******r 的大作中提到】 : yes, I artificially put some tabs in file for testing this.
|
|
O******e 发帖数: 734 | 9 $ cat -T test.dat
abc^Ixyz
$ sed -e 's/\t/TAB/' test.dat
abcTABxyz
$ sed -e 's/\\t/TAB/' test.dat
abc xyz
$ sed -e 's/ /TAB/' test.dat (Ctrl-I used in the regexpr)
abcTABxyz
$ sed -e "s/\t/TAB/" test.dat
abcTABxyz
$ sed -e "s/\\t/TAB/" test.dat
abcTABxyz
$ sed -e "s/ /TAB/" test.dat (Ctrl-I used in the regexpr)
abcTABxyz
In the above examples I can type the TAB character in the shell
either using Ctrl-V followed by TAB or Ctrl-V followed by Ctrl-I.
【在 e*****w 的大作中提到】 : you need to escape \ with \\ ba.
|
W*W 发帖数: 293 | |