Guest User

Untitled

a guest
Oct 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. PAT --example html http://askubuntu.com/page01
  2. ABC
  3. DEF
  4.  
  5. PAT --example html http://askubuntu.com/page02
  6. GHI
  7. JKL
  8.  
  9. PAT --example html http://askubuntu.com/page03
  10. MNO
  11. PQR
  12.  
  13. $ cat page01.txt
  14. ABC
  15. DEF
  16. $ cat page02.txt
  17. GHI
  18. JKL
  19. $ cat page03.txt
  20. MNO
  21. PQR
  22.  
  23. awk -F/ '/^PAT/{close(file);file = $NF; next} /./{print >> file}' foo
  24.  
  25. $ head page0*
  26. ==> page01 <==
  27. ABC
  28. DEF
  29.  
  30. ==> page02 <==
  31. GHI
  32. JKL
  33.  
  34. ==> page03 <==
  35. MNO
  36. PQR
  37.  
  38. perl -00ne 's#PAT.*/(.*)n##; open($F,">","$1.txt"); s/ns*(n|$)//g;
  39. print $F "$_n"' original.txt
  40.  
  41. perl -00ne 's#PAT.*//(.*)n##; $k=$1; $k=~s#[./]##g;open($F,">","$k.txt");
  42. s/ns*(n|$)//g; print $F "$_n"' original.txt
  43.  
  44. askubuntucompage01.txt
  45. askubuntucompage02.txt
  46. askubuntucompage03.txt
Add Comment
Please, Sign In to add comment