Dig*_*oss 162
UNEXPAND(1) User Commands UNEXPAND(1)
NAME
unexpand - convert spaces to tabs
SYNOPSIS
unexpand [OPTION]... [FILE]...
DESCRIPTION
Convert blanks in each FILE to tabs, writing to standard output. With
no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options
too.
-a, --all
convert all blanks, instead of just initial blanks
--first-only
convert only leading sequences of blanks (overrides -a)
-t, --tabs=N
have tabs N characters apart instead of 8 (enables -a)
-t, --tabs=LIST
use comma separated LIST of tab positions (enables -a)
--help display this help and exit
--version
output version information and exit
. . .
STANDARDS
The expand and unexpand utilities conform to IEEE Std 1003.1-2001
(``POSIX.1'').
Run Code Online (Sandbox Code Playgroud)
Jon*_*han 41
我想你可以试试awk
awk -v OFS="\t" '$1=$1' file1
Run Code Online (Sandbox Code Playgroud)
或SED,如果你preffer
sed 's/[:blank:]+/,/g' thefile.txt > the_modified_copy.txt
Run Code Online (Sandbox Code Playgroud)
甚至是tr
tr -s '\t' < thefile.txt | tr '\t' ' ' > the_modified_copy.txt
Run Code Online (Sandbox Code Playgroud)
或Sam Bisbee提取的tr解决方案的简化版本
tr ' ' \\t < someFile > someFile
Run Code Online (Sandbox Code Playgroud)
Joh*_*kin 10
使用Perl:
perl -p -i -e 's/ /\t/g' file.txt
Run Code Online (Sandbox Code Playgroud)
小智 9
更好的tr命令:
tr [:blank:] \\t
Run Code Online (Sandbox Code Playgroud)
这将清除say,unzip -l的输出,以便用grep,cut等进一步处理.
例如,
unzip -l some-jars-and-textfiles.zip | tr [:blank:] \\t | cut -f 5 | grep jar
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
108129 次 |
| 最近记录: |