01-14-2013
When programming, you should always strive for the most efficient (ressources, time, ...) code if the correct functionality allows. In the case above, logging in twice to the remote system is quite wasteful, so try to use sth. like ls -l /.../backup?... to get the two (or more) sizes in one go. Assigning them to variables can be done later on the local host.
BTW - if you want to base your decision to copy or not on the file size, the -h option to ls is the worst you can do - the differences will be lumped together to Megs or Gigs but you need to be aware of every single byte change!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have 2 files
file1
1 TMQUEUE QUE1 STMW633A
100 DMADM DOMGRPSTMW633A STMW633A
100 GWADM GWTGRPSTMW633A STMW633A
100 GWADM GWTGRPSTMW633AA STMW633A
100 GWADM GWTGRPSTMW638A STMW638A
100 TMSYSEVT EVTGRPSTMW633A STMW633A
100 TMSYSEVT ... (2 Replies)
Discussion started by: kaustubh137
2 Replies
2. Shell Programming and Scripting
I probably could have done this at one time, but, the years and no need has left my scripting skills lacking and I'm unable to work this problem out. https://www.unix.com/images/smilies/frown.gif
:(
Using Linux, have a great many xml files in which there may be multiple occurrence of a line of... (13 Replies)
Discussion started by: xenixuser
13 Replies
3. Shell Programming and Scripting
Hi All,
How do I search first string & second string and copy all content between them from one file to another file?
Please help me..
Thanks In Advance.
Regards,
Pankaj (12 Replies)
Discussion started by: pankajp
12 Replies
4. UNIX for Dummies Questions & Answers
Hiiii Friends
I have 2 files with huge data. I want to compare this 2 files & if they hav same set of vales in specific rows & columns i need to get that value from one file & replace it in other.
For example: I have few set data of both files here:
a.dat:
PDE-W 2009 12 16 5 29 11.11 ... (10 Replies)
Discussion started by: reva
10 Replies
5. Shell Programming and Scripting
Hello All
I have a xml file with many sets of records
like this
<mytag>mydata</mytag>
<tag2>data&</tag2>
also same file can be like this
<mytag>mydata</mytag>
<tag2>data&</tag2>
<tag3>data2&data3</tag3>
Now i can grep & and replace with & for whole file but it will replace all... (4 Replies)
Discussion started by: lokaish23
4 Replies
6. Red Hat
how can i copy a certain word from a text file then use this word to replace in another text file??
i tried to use something like:
awk '{print "Hit the",$1,"with your",$2}' /aaa/qqqq.txt > uu.txt
but i can't add an argument to point to the second file which i will replace in.
please... (8 Replies)
Discussion started by: mos33
8 Replies
7. Shell Programming and Scripting
Beginner/Intermediate shell; comfortable in the command line.
I have been looking for a solution to a backup problem. I need to compare Directory 1 to Directory 2 and copy all modified or new files/directories from Directory 1 to Directory 3. I need the directory and file structure to be... (4 Replies)
Discussion started by: Rod
4 Replies
8. UNIX for Dummies Questions & Answers
All,
I have to copy huge file from one location to another using python . I want to make sure the execution of Copy command is successful and all the files are copied properly (there has not been any abrupt interruption to the copy process or error like no space available is encountered during... (5 Replies)
Discussion started by: IshuGupta
5 Replies
9. Shell Programming and Scripting
// Redhat
I have this code working, but need to add one more qualification so that I don't overwrite the files.
#!/bin/sh
cd /P2/log/cerner_prod/millennium/archive/
for f in *
do || continue #If this isn't a regular file, skip it.
&& continue #If a backup already... (2 Replies)
Discussion started by: Daniel Gate
2 Replies
10. Shell Programming and Scripting
Sometimes when I boot, my system goes into emergency mode.
I then use Clonezilla to restore an image.
Usually the image is older than the current date.
This is part of a backup script that runs as a startup program.
cd /home/andy/bin/
zip -u -q Ubuntu_Scripts.zip *.sh *.rb *.c *.py... (22 Replies)
Discussion started by: drew77
22 Replies
LEARN ABOUT DEBIAN
tcp-environ
tcp-environ(5) File Formats Manual tcp-environ(5)
NAME
tcp-environ - TCP-related environment variables
DESCRIPTION
The following environment variables describe a TCP connection. They are set up by tcp-env, tcpclient, and tcpserver. Note that TCPLOCAL-
HOST, TCPREMOTEHOST, and TCPREMOTEINFO can contain arbitrary characters.
PROTO
The string TCP.
TCPLOCALHOST
The domain name of the local host, with uppercase letters converted to lowercase. If there is no currently available domain name for
the local IP address, TCPLOCALHOST is not set.
TCPLOCALIP
The IP address of the local host, in dotted-decimal form.
TCPLOCALPORT
The local TCP port number, in decimal.
TCPREMOTEHOST
The domain name of the remote host, with uppercase letters converted to lowercase. If there is no currently available domain name for
the remote IP address, TCPREMOTEHOST is not set.
TCPREMOTEINFO
A connection-specific string, perhaps a username, supplied by the remote host via 931/1413/IDENT/TAP. If the remote host did not sup-
ply connection information, TCPREMOTEINFO is not set.
TCPREMOTEIP
The IP address of the remote host.
TCPREMOTEPORT
The remote TCP port number.
SEE ALSO
tcpclient(1), tcpserver(1), tcp-env(1), tcp(4)
tcp-environ(5)