Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PAT --example html http://askubuntu.com/page01
- ABC
- DEF
- PAT --example html http://askubuntu.com/page02
- GHI
- JKL
- PAT --example html http://askubuntu.com/page03
- MNO
- PQR
- $ cat page01.txt
- ABC
- DEF
- $ cat page02.txt
- GHI
- JKL
- $ cat page03.txt
- MNO
- PQR
- awk -F/ '/^PAT/{close(file);file = $NF; next} /./{print >> file}' foo
- $ head page0*
- ==> page01 <==
- ABC
- DEF
- ==> page02 <==
- GHI
- JKL
- ==> page03 <==
- MNO
- PQR
- perl -00ne 's#PAT.*/(.*)n##; open($F,">","$1.txt"); s/ns*(n|$)//g;
- print $F "$_n"' original.txt
- perl -00ne 's#PAT.*//(.*)n##; $k=$1; $k=~s#[./]##g;open($F,">","$k.txt");
- s/ns*(n|$)//g; print $F "$_n"' original.txt
- askubuntucompage01.txt
- askubuntucompage02.txt
- askubuntucompage03.txt
Add Comment
Please, Sign In to add comment