Thread: using SED

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    722

    using SED

    I'd like to use sed to erase all newline from a file. sed uses *nix RE syntax, but I can't guess how to write a simple command to remove white characters (\x20\r\n\v\t) from a file....

    I found this page with some basic info, which lead me to conclude that sed works line by line.... Who can I make it join all lines in one??
    assume \r\n newlines, but I want to clear all whitespaces.

    thanks in advance
    Last edited by xErath; 10-04-2005 at 09:15 PM.

  2. #2
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    hmm, I don't know if you can do this with sed, you can probably do it with awk though, use the printf function of awk and just don't put in the "\n". If I remember the syntax, it would be something like:

    Code:
    $ awk '{printf("%d", $*);}'
    That might not be exactly right, but I know it's something like that, I've done it before, maybe do a quick search for an awk tutorial.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parsing a string like I would with grep and sed
    By Motark in forum C Programming
    Replies: 8
    Last Post: 11-13-2008, 12:10 PM
  2. Sed and the nth-occurence flag.
    By indigo0086 in forum Linux Programming
    Replies: 1
    Last Post: 07-19-2007, 09:09 PM
  3. xml file parsing in C
    By lonbgeach in forum Tech Board
    Replies: 31
    Last Post: 12-14-2006, 02:14 AM
  4. sed programming Help need..
    By anwar_pat in forum Tech Board
    Replies: 3
    Last Post: 11-24-2006, 11:01 AM
  5. problem in using a library (libpci.a)
    By jeanyves in forum C Programming
    Replies: 2
    Last Post: 06-17-2004, 08:36 AM