To access another server/machine we use ssh to authenticate and do communication.
Syntax :
>ssh user@server -P password
This will login to another machine from our local system.
Sometime we may need to fetch the content from another file in remote system , in this case we can use the below form
>ssh user@server -P password "cat /home/abc/1.txt | grep <Text to search>"
If we echo the above we can see the content from our system
Eg :
echo $(ssh user@server -P password "cat /home/abc/1.txt | grep MMDDYYYY")
This will fetch the line with the date format specified from the file.
Comments
Post a Comment