We can use a text editor, such as vi to do the copy paste.
It will be convenient to do it in command line with just cat and >.
Here is the example, the normal way is echo some thing followed by >.
In case of multi-line, we need to use <<EOF to mark the end of the file.
EOF won't be a literal string that enters the final result, it is the marker of End Of File instead.
here is the example code:
demo>cat > demo.txt <<EOF
> adfd
> dfadfad
> adfafa
> EOF
demo>cat demo.txt
adfd
dfadfad
adfafa
demo>
The file content is now get updated with your strings.
No comments:
Post a Comment