我想知道如何在文件中grep out(exclude)變量?如何清除文件中的變量?
例如file.txt的:
PATH1=/path/to/file
PATH2=/path/to/anotherfile
PATH3=/path/to/thirdfile
TEST=$(echo $RANDOM)
* * * * *\5 top -n 1 > /tmp/$TEST
* * * * * echo hello # = for deletion
我想不變量只打印cron作業: 如:
* * * * *\5 top -n 1 > /tmp/$TEST
* * * * * echo hello # = for deletion
注意,有在年底等號,我需要以保持這些線。 拖尾這個文件不是一個解決方案,當然可以有不止一行的變量。 有什麼想法?
'grep的-v「$」'? –