The original picture is in the local, the outward guide picture is particularly simple, as long as the execution of the CP script is good, but now the pictures are migrated to seven cattle, and then export the picture on the trouble in seven cattle have a qshell tool inside there is a qdownload
Qdownload |
Synchronizing data from seven cow space to local, supporting files that only have certain prefixes synchronized, support incremental synchronization |
Qshell qdownload qdownload.conf is so used qdownload.conf for the configuration file inside there is such a configuration, the other configuration is not given. "prefix" : "", fill in the image prefix to my file is this, cp/root/export_files/1025168/ Dfeafa0a-6f96-4b32-88c1-dde103b3655a/1453366970085.jpg/root/export_files/8155-003f-3115.jpg altogether more than 2000 Zhang ... I'll use the file for a second. cat CP export path. txt | Awk-f/' {print $4 '/' $ $ ' > new_image.txt get this format 1025168/dfeafa0a-6f96-4b32-88c1-dde103b3655a, then the configuration file line should be written like this " Prefix " : " 1025168/dfeafa0a-6f96-4b32-88c1-dde103b3655a ", then I want to finish Qshell every time qdownload Qdownload.conf then automatically modifies the path of the prefix and then changes the path to the next path that needs to be executed. began to write the configuration file as "prefix" : "/1025168/because no method was found to split the delimiter. Dfeafa0a-6f96-4b32-88c1-dde103b3655a/", split with/for a delimiter cat qdownload.conf | grep prefix | Awk-f '/' {print '/' $ $ '/' $ $ '/'} ' get/1025168/dfeafa0a-6f96-4b32-88c1-dde103b3655a/Test command: path=/1051742/ 0f6faaa4-808c-4320-87a3-c95f0bdc20b5/path1= ' Cat qdownload.conf | grep prefix | Awk-f '/' {print '/' $ $ '/' $ $ '/'} ' sed-i ' s/$path 1/$path/g "'grep prefix-rl qdownload.conf './qshell qdownload qdownload.conf but tested, /1051742/ 0f6faaa4-808c-4320-87a3-c95f0bdc20b5/This format can no longer be downloaded on seven kn 1051742/ 0f6faaa4-808c-4320-87a3-c95f0bdc20b5 can then find the modified Test command with the "split as Delimiter" method: path=1051742/ 0f6faaa4-808c-4320-87a3-c95f0bdc20b5path1= ' Cat qdownload.conf | grep prefix | Awk-f ' "' {print $4} ' sed-i" s/$path 1/$path/g "' grep prefix-rl qdownload.conf './qshell qdownload qdownload.conf Test After the trial, the third sentence did not succeed in thinking to find Sed-i "s/$path 1/$path/g" ' grep prefix-rl qdownload.conf 'The phrase '/' may be in conflict with '/' in the variable, resulting in a failureChange this sentence to sed-i "[email protected][email protected][email protected]" ' grep prefix-rl qdownload.conf to final script #!/bin/ Bashwhile read pathdopath1= ' cat qdownload.conf | grep prefix | Awk-f ' "' {print $4} ' sed-i" [email protected][email protected][email protected] ' grep prefix-rl qdownload.conf './qsh Ell/qshell qdownload download.confdone<image.txt script completed, just so two sentences, but in this process took a lot of detours, think of another cycle, but (thinking too silly) ruled out. By the way also studied and reviewed some VI processing text commands and SED commands I think if the use of VI command proficiency, with VI processing text, than with the editing software, more convenient. Summary of the command: 1, replace the file with newstring file.txt oldstringsed-i "s/oldstring/newstring/g" "grep oldstring-rl file.txt ' 2, with" as a separator, Intercept the fourth part of each line cat File.txt | Awk-f ' "' {print $4} ' 3, vi processing text:%s/^/\//header plus/:%s/$/\//line end plus/:%s/^\///g line minus/:%s/\/$//g row tail minus/:%s/^\s*//g start minus space: g /^$/d Delete empty line:%s/oldstring/newstring/g Replace all:%s/oldstring/newstring/replaces the first string of each line
Export Seven Bull pictures