Re: Removing every other word from a text file

From: Jan van den Broek (fortytwo_at_xs4all.nl)
Date: 04/29/03


Date: Tue, 29 Apr 2003 15:03:48 MET

29 Apr 2003 04:34:20 -0700
andycheung2000@hotmail.com (Andy Cheung) schrieb:
>Could someone please help me with editing a text file? I have a large
>text file in which I need to remove every other word. That is, word
>numbers 2,4,6,8,10 etc need to be deleted. Is there a Vi command or
>some other command I can use to do this easily?

You might try someting like:
sed 's/[ <TAB>]/<CTRL-V><CTRL-M>/g/'|awk 'NR%2 {print $0}'|fmt

This is untested, but it might be a starting point.

-- 
            Jan van den Broek          balglaas@xs4all.nl
===============================================================================
          "Het ene gaat altyd in de richting van het andere", 
                        Johan Cruyff   3-VIII-'92


Relevant Pages

  • RE: Insert a Record?
    ... Use the old INSERT command. ... VFP 3.0 Help file: ... The new record is then displayed for editing. ... In Visual FoxPro, INSERT cannot be used on a table in a database that has ...
    (microsoft.public.fox.helpwanted)
  • Re: Question about write a simple shell : how to output resoult to tty correctly
    ... std::cout to do your command I/O. ... "raw" mode to allow you to override the built-in editing. ... may be just too lazy to study "tty" it self. ...
    (comp.unix.programmer)
  • Re: [MSH] MSH Not So Great For Interactive Users
    ... The keystrokes involved date back to the earliest versions of DOS in some cases, but primarily aim for compatibility with DOSKEY, which dates from DOS 5.0 iirc. ... I wasn't talking about arrow key editing but rather command line editing and substitution done via syntactic operators. ... http://www.coldie.net/project/jamsh is a MSH host that uses the GNU readline library and is probably a lot closer to what you are looking for - MSH with vi or emacs keystrokes. ... One big step in the right direction was the commitment that everything that can be done from a GUI can now be done from the command line. ...
    (microsoft.public.windows.server.scripting)
  • Re: RPN vs Algebraic UTPN failure in program
    ... It's actually normal, a direct consequence of the editing rules, ... The same would occur if you pressed any other command key ... whenever you are editing in RPN mode, ... you have to turn on the editor's PRG (program editing) state, ...
    (comp.sys.hp48)
  • Re: [MSH] Bug: cut & paste with tabs
    ... implemented in Windows by a subsystem instead of in a user mode library like ... automatically gets essentially the same command line editing behaviour. ... > So this means that MSH actually invokes the cmd.exe shell? ...
    (microsoft.public.windows.server.scripting)