Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. # This is the raw data
  2.  
  3. blah1
  4. blah2 la la la
  5. blah3
  6. CIP3BeginFront <---- I want to take everything AFTER this
  7. this is
  8. cip data for
  9. the front
  10. CIP3EndFront <---- and BEFORE this, and set it aside as FrontData
  11. CIP3BeginBack <---- then take everything AFTER this
  12. and this is
  13. also cip data
  14. but for the back
  15. CIP3EndBack <---- and BEFORE this, and set it aside as FrontData
  16. endblah
  17. endblah2
  18. endblah3
  19.  
  20. # End raw data
  21.  
  22. I then need to put FrontData where BackData was, and vice versa.
  23.  
  24. My plan for the program is this:
  25.  
  26. open the sourcefile.txt
  27. create values, Front = False, Back = False
  28. while file is open:
  29. read every line
  30. if line is CIP3BeginFront set Front = True
  31. while Front = True, write line to FrontData.txt, delete line
  32. if line is CIP3EndFront set Front = False
  33. if line is CIP3BeginBack set Back = True
  34. while Back = True, write line to BackData.txt, delete line
  35. if line is CIP3EndFront set Back = False
  36. # reading is done because file ended
  37. read every line
  38. if line is CIP3BeginFront set Front = True
  39. while Front = True, insert BackData.txt after current line, set Front = False
  40. if line is CIP3BeginBack set Back = True
  41. while Back = True, insert FrontData.txt after current line, set Back = False
  42. write to sourcefile.txt
  43. delete FrontData.txt, BackData.txt
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement