Code Snippets/sed

From Yossi Farjoun's Homepage
(Difference between revisions)
Jump to: navigation, search
(Created page with ' To change a latex file from having (\ref{eq:blah}) to \eqref{eq:blah} (note the use of eq: in the label!) sed -e "s/(\\\\ref{\(eq:[^}]*\)})/\\\\eqref{\1}/g" < FarjounShaef…')
 
 
Line 1: Line 1:
 
+
<h2>To change a latex file from having (\ref{eq:blah}) to \eqref{eq:blah} (note the use of eq: in the label!)</h2>
To change a latex file from having (\ref{eq:blah}) to \eqref{eq:blah} (note the use of eq: in the label!)
+
  
 
     sed -e  "s/(\\\\ref{\(eq:[^}]*\)})/\\\\eqref{\1}/g" < FarjounShaeffer.tex > text.tex
 
     sed -e  "s/(\\\\ref{\(eq:[^}]*\)})/\\\\eqref{\1}/g" < FarjounShaeffer.tex > text.tex
  
----
+
 
 +
<h2>Mass rename using sed</h2>
 +
for f in * ; do n=`echo $f | sed "s/\(.?*\) 1.m4a/\1.m4a/" `; mv  "$f" "$n"; done;

Latest revision as of 13:43, 11 June 2010

To change a latex file from having (\ref{eq:blah}) to \eqref{eq:blah} (note the use of eq: in the label!)

   sed -e  "s/(\\\\ref{\(eq:[^}]*\)})/\\\\eqref{\1}/g" < FarjounShaeffer.tex > text.tex


Mass rename using sed

for f in * ; do n=`echo $f | sed "s/\(.?*\) 1.m4a/\1.m4a/" `; mv  "$f" "$n"; done;
Personal tools