I want to print the out put of the dig command to a text file .
Asked
Active
Viewed 989 times
-2
-
Did you try anything – janith1024 Jun 16 '18 at 04:25
-
dig_output =`dig -f | grep Answer | awk '{printf $1,$2}'` #echo $dig_output >> dig_output.txt – nimanthi peiris Jun 16 '18 at 04:43
-
[What are the shell's control and redirection operators?](https://unix.stackexchange.com/q/159513/56041), [Redirect all output to file](https://stackoverflow.com/q/6674327/608639), [How can I redirect and append both stdout and stderr to a file with Bash?](https://stackoverflow.com/q/876239/608639), etc. – jww Jun 16 '18 at 15:13
1 Answers
-1
Any Command in shell can be redirected like this:
Example:
dig google.com > k.txt

Shankar Shastri
- 1,134
- 11
- 18
-
Thank you. But how could i print only the needed parts. as TTL value – nimanthi peiris Jun 16 '18 at 04:44