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 / 4102
    TXT-file question —Dave Schuler
   Hello all: I have a bunch of text files, each of which contains a character sequence (say, ABCD) that I need to change (say, to WXYZ). The character sequence is within the body of each file, rather than the title. Is there an easy method of swapping (...) (22 years ago, 18-Dec-02, to lugnet.off-topic.geek)
   
        Re: TXT-file question —Kyle McDonald
   (...) Are you on windows? (if so I don't know) or on UNIX/linux? If you're on UNIX or linus you could use sed. 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 (...) (22 years ago, 18-Dec-02, to lugnet.off-topic.geek)
   
        Re: TXT-file question —Dan Boger
   (...) 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'. :) Dan (22 years ago, 18-Dec-02, to lugnet.off-topic.geek)
   
        Re: TXT-file question —Dave Schuler
   (...) 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)
   
        Re: TXT-file question —Christopher Tracey
     (...) try textpad (IMO the best text editor for the win-systems). you can download a version at www.textpad.com. there is a feature in the find-replace dialog where you can replace text in mulitple files at once. -chris (22 years ago, 18-Dec-02, to lugnet.off-topic.geek)
    
         Re: TXT-file question —Richard Marchetti
     (...) YES!!! I did this the other week for some of the castle world pages. It had never come up for me before until that occasion, but yeah -- Textpad will replace a given piece of text in all open files. I don't know if it had a limit but I had (...) (22 years ago, 20-Dec-02, to lugnet.off-topic.geek)
    
         Re: TXT-file question —Christopher Tracey
     (...) i've done ~220 files at once... textpad does not seem to have a limit so far in every test. i've had >150,000 line files open in it with out a problem- contrast that to the 65,000 line limit in word or excel. (...) definately, one of the best (...) (22 years ago, 21-Dec-02, to lugnet.off-topic.geek)
    
         Re: TXT-file question —Dan Boger
     Quoting Christopher Tracey <ctracey@enviroweb.org>: (...) I was going to let it slide, but why use anything but vim? it has a nice windows GUI, and can do anything (include fetch you a sode from the vending machine :) Dan (22 years ago, 23-Dec-02, to lugnet.off-topic.geek)
   
        Re: TXT-file question —David Eaton
     (...) There may be some batch commands you can use, but I'm not sure offhand-- I used to be somewhat of a whiz with Windows NT batch (1), but it's been a while... not to mention that I know Windows 95/98 didn't have the same functionality for "for" (...) (22 years ago, 18-Dec-02, to lugnet.off-topic.geek)
    
         Re: TXT-file question —Thomas Wölk
     <snip> (...) have (...) on (...) was (...) <snip> and <sigh> oh dear, yup those were the days, writing simple batch files and people calling you a programer. my computers were organized and navigated with batch files since 92 because windows was so (...) (22 years ago, 19-Dec-02, to lugnet.off-topic.geek)
    
         Re: TXT-file question —David Eaton
     (...) Oh, I would usually scoff anyone who called themselves a programmer for having written batch code, but this stuff was fully fledged programming. My boss had me doing testing on a linker that was written for a DSP. It started as "maybe you (...) (22 years ago, 19-Dec-02, to lugnet.off-topic.geek)
    
         Re: TXT-file question —Thomas Wölk
      David Eaton <deaton@intdata.com> schrieb in im Newsbeitrag: H7DtC2.CM3@lugnet.com... (...) with (...) wacky (...) wasn't saying batch coding is programming. the stress was meant to be on "simple" and on the mistaking batch coding for programming. (...) (22 years ago, 19-Dec-02, to lugnet.off-topic.geek)
   
        Re: TXT-file question —Ross Crawford
   (...) Or get PERL for Windows (URL) (22 years ago, 18-Dec-02, to lugnet.off-topic.geek)
 

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