Hi,
I'm sure that is possible (awk comes to mind), but why the need for one command, it would complicate things (just my 2c).
This grep something file || echo "text" >> file will do what you want. Short and elegant.
The || is an OR statement, if grep doesn't find anything ("fails" if you want) the echo statement is executed. There is also the && (AND) command (do something if previous command is successful).
Hope this helps.
|