Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. head1 head2 head3
  2. a b c
  3. c
  4. c a
  5.  
  6. head1 head2 head3
  7. a b c
  8. - c -
  9. c - c
  10.  
  11. perl -ne '
  12. while (length) {
  13. ($word = substr($_,0,10)) =~ s/^s+|s+$//g; # trim whitespace
  14. $word ||= "-";
  15. print $word, " ";
  16. substr($_,0,10) = "";
  17. }
  18. print "n";
  19. ' file
  20.  
  21. sed 's/^ //g' input | tr -s "[:blank:]" "," |
  22. awk -F, '!$1{printf "- "} $1{printf "%s ", $1}
  23. !$2{printf "- "} $2{printf "%s ", $2}
  24. !$3{print "-"} $3{print $3}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement