How can I 1st test to see if a sed command works before actually running the command?
For eaxmple:
> sed '1,5 s/\<searchdata\>/replacedata/' filename
One solution I've come-up is ...
> sed '1,5 s/\<searchdata\>/replacedata/' filename | grep replacedata
then check the exit status (e.g. $?)
...is there a better way?
For eaxmple:
> sed '1,5 s/\<searchdata\>/replacedata/' filename
One solution I've come-up is ...
> sed '1,5 s/\<searchdata\>/replacedata/' filename | grep replacedata
then check the exit status (e.g. $?)
...is there a better way?