I got a requirement to get the filenames and timestamp into an array like below.
So as the first step I have downloaded the required files from remote server using scp .To preserve the server time have added -p flag.
Code
Output
Following to this I tried by getting the required fields by awk command as follows
This works fine by shell commands.Is it possible to club the awk in the scp command and redirect the output to a file.I tried by piping but it is not giving any result.
Another way is to change to the required directory and put awk command.But cd is not working in shell script.
Please suggest a way to resolve this.
Moderator's Comments:
Please wrap all code, files, input & output.errors in CODE tags.
It makes it easier to read and preserves multiple spaces for indenting or fixed-width data.
Hi all,
i have a directory in server A. the directory path is /home/kevin. I need to scp the directory to another server B. i would like to ask, when i do a scp of the /home/kevin , i can expect all the files from A to go B. However, how about the hidden files? for example the ssh keys in the... (4 Replies)
Hi Friends,
I need to execute a scp command to transfer some files from source to target server. Unfortunately the ftp is not working in my case.
This scp command needs to be executed via Unix script.
I need to know the complete scp command which includes the user-id and password of the... (2 Replies)
I normally download a directory recursively using:
scp -r <name>@host:<path> .
This has worked fine. As everyone knows this will download all of the directory named in <path> and all of the sub directories.
I would like to know if it is possible to not download a particular file if it... (5 Replies)
I would like to use the result of a query in another query. How do I redirect/add the output to another variable?
$result = odbc_exec($connect, $query);
while ($row = odbc_fetch_array($result)) {
echo $row,"\n";
}
odbc_close($connect);
?>
This will output hostnames:
host1... (0 Replies)
Hi,
I have a requirement as below which needs to be done viz UNIX shell script
(1) I have to connect to an Oracle database
(2) Exexute "SELECT field_status from table 1" query on one of the tables.
(3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Hi,
I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database.
For instance:
USER CITY
--------- ----------
A CITY_A
B CITY_B
C ... (2 Replies)
How to copy multiple directories using single command on solaris 10 from server A to server B.
I tried scp but its working only one directory at atime
How to acheive this with simple and short solution????? (6 Replies)