Guest User

Untitled

a guest
May 8th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Is there a one line way to remove dollar signs from a string via sed?
  2. echo $line
  3.  
  4. {On the image of {$p$}-adic regulators},
  5.  
  6. echo $line | sed 's/$//g'
  7.  
  8. {On the image of {p}-adic regulators},
  9.  
  10. title=`echo $line | sed 's/$//g'`; echo $title
  11.  
  12. {On the image of {$p$}-adic regulators},
  13.  
  14. title=`echo $line | sed 's/\$//g'` # note two backslashes before $
  15.  
  16. [lsc@aphek]$ echo ${line//$/}
  17. {On the image of {p}-adic regulators},
  18.  
  19. [me@home]$ title=$(echo $line | sed 's/$//g'); echo $title
  20. {On the image of {p}-adic regulators},
  21.  
  22. [jaypal:~/Temp] awk '{gsub(/$/,"",$0);print}' <<< $line
  23. {On the image of {p}-adic regulators},
  24.  
  25. [jaypal:~/Temp] title=$(awk '{gsub(/$/,"",$0);print}' <<< $line); echo $title
  26. {On the image of {p}-adic regulators},
Advertisement
Add Comment
Please, Sign In to add comment