
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.75 KB | hits: 11 | expires: Never
Is there a one line way to remove dollar signs from a string via sed?
echo $line
{On the image of {$p$}-adic regulators},
echo $line | sed 's/$//g'
{On the image of {p}-adic regulators},
title=`echo $line | sed 's/$//g'`; echo $title
{On the image of {$p$}-adic regulators},
title=`echo $line | sed 's/\$//g'` # note two backslashes before $
[lsc@aphek]$ echo ${line//$/}
{On the image of {p}-adic regulators},
[me@home]$ title=$(echo $line | sed 's/$//g'); echo $title
{On the image of {p}-adic regulators},
[jaypal:~/Temp] awk '{gsub(/$/,"",$0);print}' <<< $line
{On the image of {p}-adic regulators},
[jaypal:~/Temp] title=$(awk '{gsub(/$/,"",$0);print}' <<< $line); echo $title
{On the image of {p}-adic regulators},