【发布时间】:2021-05-05 04:08:14
【问题描述】:
我正在使用此代码
cut -c1 | tr -d '\n'
基本上取并打印出每一行的第一个字母。问题是,我需要在末尾换行,但只在末尾,在“caroline”一词之后(这些是 testfile
的内容不能使用 AWK、basename、grep、egrep、fgrep 或 rgrep
【问题讨论】:
标签: linux echo command-line-arguments tr
我正在使用此代码
cut -c1 | tr -d '\n'
基本上取并打印出每一行的第一个字母。问题是,我需要在末尾换行,但只在末尾,在“caroline”一词之后(这些是 testfile
的内容不能使用 AWK、basename、grep、egrep、fgrep 或 rgrep
【问题讨论】:
标签: linux echo command-line-arguments tr
尝试使用awk 实用程序,如下所示:-
awk -F\| '$1 > 0 { print substr($1,1,1)}' testfile.txt
【讨论】:
使用回声
echo $( cut -c1 | tr -d '\n' ) \n
【讨论】:
cut -c1 | tr -d '\n'; echo -e '\n'
【讨论】: