1, according to a specified section of the path, the data copy.
= head Assembly.txt /ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbarabpei-119/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbcrabpei-135/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbdraapei- -/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbfrabpei-126/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbgrabpei-127/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbhrabpei-138/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbiraapei- -/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbjraapei- -/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustbkraapei- the/e3/gap/e3.scafseq_200/ifs1/st_env/user/liyiyuan/liushanlin/1kite_1_2/110817_i809_fcd05cdacxx_l3_insbustblraapei- the/e3/gap/e3.scafseq_200
Synchronous copying of #在当前目录把liushanlin/down data according to the original relative path
Cat assembly.txt| while read i; Do ' liushanlin/ ' ' {print $} ' ' /[^/]*$ ' ' {print $} ' " finished: $i \t$b " >>rsync.log;done
2. Parse path get file name and directory name
Get file name
#awk解法: Use "/" to make the delimiter, then print out the last part.
" / " ' {print $NF} "'
#官方解法 (basename): The Bash shell itself provides the basename command to get the file name of the pathname directly.
Resfile= ' Basename/tmp/csdn/zhengyi/test/adb.log '
Get directory Name
#awk解法: You can use the flexible delimiter to mix regular expressions.
' /[^/]*$ ' ' {print $} "'
Method of #awk +for cycle
' begin{res= ""; fs= "/";} {for (i=2;i<=nf-1;i++) res= (res "/" $i);} End{print res}'
#官方解法 (basename): The Bash shell itself provides the dirname command, which is especially handy to get the directory name of the path directly.
Dirpath= ' Dirname/tmp/csdn/zhengyi/test/adb.log '
Shell command real-combat detailed