To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 4108
4107  |  4109
Subject: 
Re: TXT-file question
Newsgroups: 
lugnet.off-topic.geek
Date: 
Wed, 18 Dec 2002 22:25:31 GMT
Viewed: 
541 times
  
In lugnet.off-topic.geek, Dave Schuler writes:
In lugnet.off-topic.geek, Dan Boger writes:
In lugnet.off-topic.geek, Kyle McDonald writes:
Somethign like: (this is untested so YMMV)

for FILE in *.txt; do
  if sed 's/ABCD/WXYZ/g' < $FILE >$FILE.new; then
    mv $FILE.new $FILE
  else
    echo Pattern not found or other error in $FILE.
    rm $FILE.new
  fi
done

If you hav Cygnus installed on your windows machine that might
work also.

or, if you have perl (windows or unix), you can do this:

perl -i.bak -p -e 's/ABCS/WXYZ/g' *.txt

which will create a backup (file.txt.bak) before changing all 'ABCD' to 'WXYZ'.

I'm on a pretty straightforward XP 98 system, alas.  Maybe I should just
pay some neighborhood kids to do it for me...

Or get PERL for Windows http://www.activestate.com/Products/ActivePerl/

ROSCO



Message is in Reply To:
  Re: TXT-file question
 
(...) I'm on a pretty straightforward XP 98 system, alas. Maybe I should just pay some neighborhood kids to do it for me... Thank you for the input, though. Dave! (22 years ago, 18-Dec-02, to lugnet.off-topic.geek)

13 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR