|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Greetings,
I have a file with contents something like 1#data1 data2# 2#data3# 3#data4# How can I replace the '#' at the end of each line with something like '||'. Here the data section might contain some newline characters which I want to ignore So the output should be 1#data1 data2|| 2#data3|| 3#data4|| Any would be appreciated. TIA |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mon, 23 Jul 2007 07:05:21 -0700, pankaj_wolfhunter@yahoo.co.in wrote:
> Greetings, > I have a file with contents something like > > 1#data1 > data2# > 2#data3# > 3#data4# > > How can I replace the '#' at the end of each line with something like > '||'. > Here the data section might contain some newline characters which I want > to ignore > > So the output should be > > 1#data1 > data2|| > 2#data3|| > 3#data4|| > > Any would be appreciated. > > TIA sed 's/#$/||/' The dollar character matches at the end of line. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Jul 23, 7:07 pm, Icarus Sparry <use...@icarus.freeuk.com> wrote:
> On Mon, 23 Jul 2007 07:05:21 -0700, pankaj_wolfhun...@yahoo.co.in wrote: > > Greetings, > > I have a file with contents something like > > > 1#data1 > > data2# > > 2#data3# > > 3#data4# > > > How can I replace the '#' at the end of each line with something like > > '||'. > > Here the data section might contain some newline characters which I want > > to ignore > > > So the output should be > > > 1#data1 > > data2|| > > 2#data3|| > > 3#data4|| > > > Any would be appreciated. > > > TIA > > sed 's/#$/||/' > > The dollar character matches at the end of line.- Hide quoted text - > > - Show quoted text - Thanks. Actually still on the learning curve so sorry for such question. Thanks again. |
|
![]() |
| Outils de la discussion | |
|
|