Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 awk 或 cut 获取第一列中的值,如下所示,但我似乎没有得到它。
7 ? Jun 18 23:31 test3folder1/
我只需要将上述输出中的数字 7 存储在变量中。我该怎么做呢?以上是“svn ls”命令的输出。
awk '{打印 $1}'
'awk' 按一个或几个连续的分隔符(在您的情况下为空格)剥离,而 'cut' 总是按单个分隔符剥离。
svn ls -v | awk '{print $1}'
我确实建议您尝试man awk一下,感受一下它的功能。
man awk