电子书是网上下载的Advanced Bash-Scripting Guide, 文本格式。
1 #! /bin/sh 2 3 awk ' 4 $1=="Chapter" { 5 mainH=$0 6 a=match($2,/[0-9]/) 7 id=substr($2,a) 8 tid=sprintf("%02d",id) 9 fid=$1tid 10 } 11 {print $0 > fid".txt"} 12 ' abs-guide.txt
电子书是网上下载的Advanced Bash-Scripting Guide, 文本格式。
1 #! /bin/sh 2 3 awk ' 4 $1=="Chapter" { 5 mainH=$0 6 a=match($2,/[0-9]/) 7 id=substr($2,a) 8 tid=sprintf("%02d",id) 9 fid=$1tid 10 } 11 {print $0 > fid".txt"} 12 ' abs-guide.txt
转载于:https://www.cnblogs.com/hunter_gio/archive/2012/09/05/2671750.html