如何将表边框的mysql查询输出重定向为分隔符?我尝试使用此代码:
mysql -u root -h localhost -D cronjob -e "select * from cron_list" > query.txt
Run Code Online (Sandbox Code Playgroud)
我期望输出如下:
| id | datetime | recurrency | command |
| 1 | 2014-10-10 | daily | bash /media/data/daily.sh |
| 2 | 2014-10-09 | minutely | conky |
Run Code Online (Sandbox Code Playgroud)
但是,当我使用该代码时,它会给我输出
id datetime recurrency command
1 2014-10-10 daily bash /media/data/daily.sh
2 2014-10-09 minutely conky
Run Code Online (Sandbox Code Playgroud)
那么,如何将终端的输出重定向到带终端的分隔符的文件?抱歉英文不好
如何*在文本文件中grep星号?这是我的代码:
if grep -F "\#$minute $hour $date $month $day $cr_user $comm" filecron; then
echo "$minute $hour $date $month $day $cr_user $comm" > /dev/null 2>&1
echo "data exist"
elif [[ -z $minute || -z $hour ]]; then
echo "#$minute $hour $date $month $day $cr_user $comm" > /dev/null 2>&1
echo "nothing to input"
echo "" >> filecron
elif [[ $stat == "inactive" ]]; then
echo "\#$minute $hour $date $month $day $cr_user $comm" >> filecron
echo "input data inactive to filecron" …Run Code Online (Sandbox Code Playgroud) 我想要grep独特的路线。这是文件内容:
this is line 1
this is line 1
this is line 2
this is line 1
this is line 1
Run Code Online (Sandbox Code Playgroud)
我只想输出this is line 2到我的外壳。我怎样才能做到这一点?