Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. $ cat 1.txt
  2. '&1'
  3. '&2'
  4. '&3'
  5.  
  6. :1
  7. :2
  8. :3
  9.  
  10. awk '{gsub(/'"^'"'|'"'$"'/,"");gsub(/&/,":")}1' input
  11. :1
  12. :2
  13. :3
  14.  
  15. sed -e 's/.*[^0-9]([0-9]+)[^0-9]*$/:1/' 1.txt
  16.  
  17. :1
  18. :2
  19. :3
  20.  
  21. $ cat 1.txt
  22. Monday {'&1', 'Morning', 'Breakfast'}
  23. Tuesday {'&2', 'Noon', 'Lunch'}
  24. Wednesday {'&3', 'Evening', 'Supper'}
  25. Thursday {'&4', 'Night', 'Dinner'}
  26.  
  27. $ sed -E 's/x27&([0-9]+)x27/:1/' 1.txt
  28. Monday {:1, 'Morning', 'Breakfast'}
  29. Tuesday {:2, 'Noon', 'Lunch'}
  30. Wednesday {:3, 'Evening', 'Supper'}
  31. Thursday {:4, 'Night', 'Dinner'}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement