s***r 发帖数: 32 | 1 Hi,
I wanted to do sth like:
perl -F"\t" -lane "print $F[0], "TAB", log($F[1])" infile.txt
There is a problem with the TAB character: I can not find a way to represent
it in a way that perl recognize.
So I have to hack sth like:
perl -F"\t" -lane "print $F[0], _______, log($F[1]+1)" in.txt|perl -pi -e "s
/_______/\t/g"
Any better ways of doing it? Thanks! | X****r 发帖数: 3557 | 2 Don't you need to esacpe $ against shell?
Under bash:
perl -F"\t" -lane "print \$F[0], \"\t\", log(\$F[1])" infile.txt
represent
e "s
【在 s***r 的大作中提到】 : Hi, : I wanted to do sth like: : perl -F"\t" -lane "print $F[0], "TAB", log($F[1])" infile.txt : There is a problem with the TAB character: I can not find a way to represent : it in a way that perl recognize. : So I have to hack sth like: : perl -F"\t" -lane "print $F[0], _______, log($F[1]+1)" in.txt|perl -pi -e "s : /_______/\t/g" : Any better ways of doing it? Thanks!
| s***r 发帖数: 32 | 3 Great! \"\t\" works! Thanks! | t****t 发帖数: 6806 | 4 it has nothing to do with tab, you are using wrong quotes (for shell)
perl -F"\t" -lane 'print $F[0], "\t", log($F[1])' infile.txt
represent
"s
【在 s***r 的大作中提到】 : Hi, : I wanted to do sth like: : perl -F"\t" -lane "print $F[0], "TAB", log($F[1])" infile.txt : There is a problem with the TAB character: I can not find a way to represent : it in a way that perl recognize. : So I have to hack sth like: : perl -F"\t" -lane "print $F[0], _______, log($F[1]+1)" in.txt|perl -pi -e "s : /_______/\t/g" : Any better ways of doing it? Thanks!
| t****t 发帖数: 6806 | 5 bah, peng myself.
【在 X****r 的大作中提到】 : Don't you need to esacpe $ against shell? : Under bash: : perl -F"\t" -lane "print \$F[0], \"\t\", log(\$F[1])" infile.txt : : represent : e "s
| X****r 发帖数: 3557 | 6 你这个更加精悍些。
【在 t****t 的大作中提到】 : bah, peng myself.
| s***r 发帖数: 32 | 7 It's windows...
I can only use " not '
Thanks anyway
【在 t****t 的大作中提到】 : it has nothing to do with tab, you are using wrong quotes (for shell) : perl -F"\t" -lane 'print $F[0], "\t", log($F[1])' infile.txt : : represent : "s
|
|