|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hi!
I have a problem with the special character "|". The problem is in subject feild it is displaying abc@def.com|efg@ijk.com|..... i have to replace the "|" with blank space can you help me out please it is very very urgent for me ![]() |
|
#2
|
|||
|
|||
|
Assuming that you have a file containing these '|'s then
probably the easiest way to fix the problem is to use sed(1) i.e. sed -e 's/\|/ /g' filename or to save output to a file sed -e 's/\|/ /g' filename > newfilename - Finnbarr |
|
#3
|
|||
|
|||
|
Hi! Finnbarr,
Thanks for your help but when i use this command direct to the file it is giving an error as sed: command garbled: s/\|/ /g, or if i save this out put to a new file and use that file then it is not even displaying the error:Can't open filename. if you can please help me out in fixing this issue |
|
#4
|
|||
|
|||
|
Finnbarr's commands are correct. With some *nix flavors you don't have to 'escape' the pipe charachter ( | vs \| ).
Are you trying to do this from the command line or a shell script? Can you post the code you tried to execute that failed? |
|
#5
|
|||
|
|||
|
Hi! Finnbarr's,
Thanks for your response here is part of script which im trying to execute 1)SUBJECTLN="`date +%m/%d/%y::%H:%M`:Order Activity Report (" 2)SUBJECT=$SUBJECTLN$gxi")" where gxi is a text file with information stored as abc|efg|..... 3)mailx -s "$SUBJECT" "$ADDRESSES" now in subject field it is printing as OUTPUT 01/26/04::11:44:Order Activity Report (abc|efg|.....) i should replace that pipe in (abc|efg|.....) and print as (abc efg ....). I tryed to use it in shell script rather than on command line but it is not working out for me. Last edited by riaz_mohd : January 27th, 2004 at 12:28 PM. |
|
#6
|
|||
|
|||
|
This works on my box:
Code:
#!/bin/sh
SUBJECTLN="`date +%m/%d/%y::%H:%M`:Order Activity Report ("
# gxi is file (filled with Foo|Bar|Foo|Bar)
gxi=/home/user/infile
SUBJECT=$SUBJECTLN`sed -e 's/|/ /g' $gxi`")"
echo $SUBJECT
# gxi declared in script
gxi="Foo|Bar"
SUBJECT=$SUBJECTLN`echo $gxi | sed -e 's/|/ /g'`")"
echo $SUBJECT
The output is: 01/27/04::19:41:Order Activity Report (Foo Bar Foo Bar) 01/27/04::19:41:Order Activity Report (Foo Bar) As you can see I did not have to escape the pipe symbol. |
|
#7
|
|||
|
|||
|
Thanks it is working really fine
Last edited by riaz_mohd : January 27th, 2004 at 01:56 PM. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > replace "|" with empty space |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|