Re: substituting space with a pipe in a text file
From: Kevin Collins (spamtotrash_at_toomuchfiction.com)
Date: 12/30/04
- Next message: Kevin Rodgers: "Re: Changing "From:" in sendmail header"
- Previous message: Kenny McCormack: "Re: Changing "From:" in sendmail header"
- In reply to: Janis Papanagnou: "Re: substituting space with a pipe in a text file"
- Next in thread: Janis Papanagnou: "Re: substituting space with a pipe in a text file"
- Reply: Janis Papanagnou: "Re: substituting space with a pipe in a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Kevin Rodgers: "Re: Changing "From:" in sendmail header"
- Previous message: Kenny McCormack: "Re: Changing "From:" in sendmail header"
- In reply to: Janis Papanagnou: "Re: substituting space with a pipe in a text file"
- Next in thread: Janis Papanagnou: "Re: substituting space with a pipe in a text file"
- Reply: Janis Papanagnou: "Re: substituting space with a pipe in a text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|