boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - what is used to represent a "tab" character in "sed"
相关主题
How to print \t in perl one-liner?
缩进用空格好,还是tab好?
How to encode YYYY-MM-DD?
Sort cygwin question
问一个基本的WinAPI问题
database open and close
python 问题
gdb breakpoint 问题
没有大牛关注Chrome Apps?
用extjs做前端的多吗?
相关话题的讨论汇总
话题: tab话题: sed话题: ctrl话题: fsfsdfsd话题: djf
进入Programming版参与讨论
1 (共1页)
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
10
1 (共1页)
进入Programming版参与讨论
相关主题
用extjs做前端的多吗?
Spark上怎么join avro format的数据?
c++ 为什么不能由负变正
求教前端大神 Jquery
初级问题 (转载)
one question about algorithm
Excel Marco
有人能解释一下这段C++代码吗
TIJ上写错了?
64 bit的机器里面一个int占多大空间呀?
相关话题的讨论汇总
话题: tab话题: sed话题: ctrl话题: fsfsdfsd话题: djf