Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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},