[Tfug] Quick command line question...
brandon
brandons.daemon at gmail.com
Wed Mar 10 15:23:21 MST 2010
On Wed, Mar 10, 2010 at 3:08 PM, Jim March <1.jim.march at gmail.com> wrote:
> Ah. Well fortunately there were no spaces in these filenames so we're all
> good.
>
> Jim
>
> On Wed, Mar 10, 2010 at 3:01 PM, brandon <brandons.daemon at gmail.com>
> wrote:
> > On Wed, Mar 10, 2010 at 2:30 PM, Jim March <1.jim.march at gmail.com>
> wrote:
> >>
> >> Concluding this (for now?) here's what actually worked:
> >>
> >> for i in *.adm; do sed 's/HandCountedPaperBallots/HCPB/g' $i>
> >> `basename $i`.TMP; done
> >> for i in *.TMP; do mv $i `basename $i .TMP`; done
> >>
> >> for i in *.adm; do sed 's/subvert DRE tabulation/subvert tabulation/g'
> >> $i> `basename $i`.TMP; done
> >> for i in *.TMP; do mv $i `basename $i .TMP`; done
> >>
> >> for i in *.adm; do sed 's/direct voter/direct voters/g' $i> `basename
> >> $i`.TMP; done
> >> for i in *.TMP; do mv $i `basename $i .TMP`; done
> >>
> >> for i in *.adm; do sed 's/direct voterss/direct voters/g' $i>
> >> `basename $i`.TMP; done
> >> for i in *.TMP; do mv $i `basename $i .TMP`; done
> >>
> >> for i in *.adm; do sed 's/jam CCOS scanner/jam scanner/g' $i>
> >> `basename $i`.TMP; done
> >> for i in *.TMP; do mv $i `basename $i .TMP`; done
> >>
> >> for i in *.adm; do sed 's/jam PCOS scanner/jam scanner/g' $i>
> >> `basename $i`.TMP; done
> >> for i in *.TMP; do mv $i `basename $i .TMP`; done
> >>
> >> :)
> >>
> >> THANKS!!!
> >>
> >> Jim
> >>
> >> _______________________________________________
> >> Tucson Free Unix Group - tfug at tfug.org
> >> Subscription Options:
> >> http://www.tfug.org/mailman/listinfo/tfug_tfug.org
> >
> > Hi Jim-
> > Something else I didn't point out is the use of quotes, didn't want to
> take
> > all the fun out of it =) If you have file names with spaces in them the
> > above will fail.
> > Thanks
> > -Brandon
> >
> > _______________________________________________
> > Tucson Free Unix Group - tfug at tfug.org
> > Subscription Options:
> > http://www.tfug.org/mailman/listinfo/tfug_tfug.org
> >
> >
>
> _______________________________________________
> Tucson Free Unix Group - tfug at tfug.org
> Subscription Options:
> http://www.tfug.org/mailman/listinfo/tfug_tfug.org
>
One last word you really should look at the man pages for sed. You could
have done all your searches and replaces with one run if you had wished. IE
using sed's script-file. A really nice feature of sed.
Thanks
-Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tfug.org/pipermail/tfug_tfug.org/attachments/20100310/8e2881f9/attachment-0002.html>
More information about the tfug
mailing list