Re: substituting space with a pipe in a text file

From: Kevin Collins (spamtotrash_at_toomuchfiction.com)
Date: 12/30/04


Date: Thu, 30 Dec 2004 18:47:40 GMT

In article <cqvjcj$uk8$1@online.de>, Janis Papanagnou wrote:
> Christian Schneider wrote:
>> Thus spake mkumar200423@rediffmail.com (mkumar200423@rediffmail.com):
>>
>>>I have an input text file which looks like this:
>>>AAA BBB CCC DDD EEE 123
>>>ADSSD SFDS ADSF FDDSF FDSFS
>>>
>>>I want to replace the spaces in the input text file with a pipe to get
>>>a resulting file like this
>>>
>>>AAA|BBB|CCC|DDD|EEE|123
>>>ADSSD|SFDS|ADSF|FDDSF|FDSFS
>>
>> | $ echo ADSSD SFDS ADSF FDDSF FDSFS | sed 's/ /|/g'
>> | ADSSD|SFDS|ADSF|FDDSF|FDSFS
>> | $ echo AAA BBB CCC DDD EEE 123 | sed 's/ /|/g'
>> | AAA|BBB|CCC|DDD|EEE|123
>
> sed 's/ \+/|/g'
          ^^

This is dependant on the version of sed. Doesn't work on HP-UX or Solaris -
might be GNU sed specific...

Kevin



Relevant Pages

  • SUMMARY: Solaris vs. HP-UX
    ... Here are some URLs that provide a lot of information on Solaris vs. HP-UX: ... Always seems to me your dollar goes a lot farther buying Sun equipment opposed ... Cluster Server over HP-UX with MC-Service Guard and lvm. ...
    (SunManagers)
  • Re: Any major differences between Solaris and HP-UX?
    ... > desktop users) to HP/UX? ... > under Windows without the need for Sambe. ... Solaris and HP-UX) while you embark on a flight of fancy? ...
    (comp.sys.hp.hpux)
  • Re: Work for hp-ux
    ... For example, Mac OS Classic comes to mind, MsDOS together with DOS-based Windows, or some versions of Linux or Linux distributions come to mind. ... There even were HP-UX and Solaris releases that fall into that category. ... And I also can't see why this should be the case for making Solaris OSS, as it primarily did cost Sun money to do that. ...
    (comp.sys.hp.hpux)
  • Re: Urgent : QUERCY sous HP-UX 11.0, compilation probleme gcc 3.2
    ... Notre binaire, qui fonctionne ... > sous Linux et Solaris, se bloque d?s la premi?re fonction de la ... > Cette librairie est d?crite comme fonctionnant sous HP-UX. ...
    (comp.sys.hp.hpux)
  • Re: HP vs SUN - Comparision
    ... HP-UX has no coolness or bleeding-edge factor as Solaris does, ... migrating to a new architecture requires sysadmin ... > fiber cards on each server, dual SAN Switches, Dual VA7410 arrays, etc. ...
    (comp.sys.hp.hpux)