cat myhistory-write-commands.txt
Example output:
910 echo "Paul" > myname.txt
913 echo "firstName=Paul" > myname.txt
915 echo "lastName=Matthews" >> myname.txt
917 history > myhistory.txt
919 history | grep '>' > myhistory-write-commands.txt
In the command above grep
is searching each line of output from the history
command for a specific character (the redirect write operator >
) and only putting matched lines into STDOUT
which is then written to myhistory-write-commands.txt
!
Take note that the redirect append operator was matched as a part of the grep
search because it is made up of two characters that matched the grep
search!