insert new line
am 06.12.2007 09:23:31 von sant527
I have file with the following content in a single line
tava śiṣyeṇa dhīmatā
CLASS=t>SYNONYMSSYNONYMS
I want to insert a new line at
How to do it using sed command.
Re: insert new line
am 06.12.2007 09:52:35 von Stephane CHAZELAS
On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant527@gmail.com wrote:
> I have file with the following content in a single line
>
>
tava śiṣyeṇa dhīmatā
> CLASS=t>SYNONYMSSYNONYMS
>
> I want to insert a new line at
>
> How to do it using sed command.
Assuming a Bourne-like shell:
sed 's,,&\
,g'
--
Stephane
Re: insert new line
am 06.12.2007 12:32:26 von Tony Winslow
Stephane Chazelas wrote:
> On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant527@gmail.com wrote:
>> I have file with the following content in a single line
>>
>>
tava śiṣyeṇa dhīmatā
>> CLASS=t>SYNONYMSSYNONYMS
>>
>> I want to insert a new line at
>>
>> How to do it using sed command.
>
> Assuming a Bourne-like shell:
>
> sed 's,,&\
> ,g'
>
sed 's,,&\n,g'
Re: insert new line
am 06.12.2007 13:11:49 von Stephane CHAZELAS
On Thu, 06 Dec 2007 19:32:26 +0800, Tony Winslow wrote:
> Stephane Chazelas wrote:
>> On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant527@gmail.com wrote:
>>> I have file with the following content in a single line
>>>
>>>
tava śiṣyeṇa dhīmatā
>>> CLASS=t>SYNONYMSSYNONYMS
>>>
>>> I want to insert a new line at
>>>
>>> How to do it using sed command.
>>
>> Assuming a Bourne-like shell:
>>
>> sed 's,,&\
>> ,g'
>>
> sed 's,,&\n,g'
No, that's not standard. The standard way is the way I gave.
\n is only standard in the LHS (in the pattern). According to
the POSIX or Unix standard, the behavior \n in the RHS is
/unspecified/. Some seds may replace with "\n", some with "n"
and some with a newline characters, some may output an error
message...
--
Stephane
Re: insert new line
am 06.12.2007 15:52:06 von Tony Winslow
Stephane Chazelas wrote:
> On Thu, 06 Dec 2007 19:32:26 +0800, Tony Winslow wrote:
>> Stephane Chazelas wrote:
>>> On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant527@gmail.com wrote:
>>>> I have file with the following content in a single line
>>>>
>>>>
tava śiṣyeṇa dhīmatā
>>>> CLASS=t>SYNONYMSSYNONYMS
>>>>
>>>> I want to insert a new line at
>>>>
>>>> How to do it using sed command.
>>> Assuming a Bourne-like shell:
>>>
>>> sed 's,,&\
>>> ,g'
>>>
>> sed 's,,&\n,g'
>
> No, that's not standard. The standard way is the way I gave.
>
> \n is only standard in the LHS (in the pattern). According to
> the POSIX or Unix standard, the behavior \n in the RHS is
> /unspecified/. Some seds may replace with "\n", some with "n"
> and some with a newline characters, some may output an error
> message...
>
i think you are right. i didn't know about it before. \
Thank you for sharing!
Re: insert new line
am 06.12.2007 16:42:42 von Michael Tosch
Stephane Chazelas wrote:
> On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant527@gmail.com wrote:
>> I have file with the following content in a single line
>>
>>
tava śiṣyeṇa dhīmatā
>> CLASS=t>SYNONYMSSYNONYMS
>>
>> I want to insert a new line at
>>
>> How to do it using sed command.
>
> Assuming a Bourne-like shell:
>
> sed 's,,&\
> ,g'
>
If you want to have a new line at *each* .
Only at the 1st
sed 's,,&\
,'
Or at each <
sed 's,<,\
<,g'
--
Michael Tosch @ hp : com
Re: insert new line
am 07.12.2007 09:53:20 von sant527
On Dec 6, 8:42 pm, Michael Tosch
wrote:
> Stephane Chazelas wrote:
> > On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant...@gmail.com wrote:
> >> I have file with the following content in a single line
>
> >> tava śiṣyeṇa dhīmatā
> >> CLASS=t>SYNONYMS
SYNONYMS
>
> >> I want to insert a new line at
>
> >> How to do it using sed command.
>
> > Assuming a Bourne-like shell:
>
> > sed 's,,&\
> > ,g'
>
> If you want to have a new line at *each* .
>
> Only at the 1st
>
> sed 's,,&\
> ,'
>
> Or at each <
>
> sed 's,<,\
> <,g'
>
> --
> Michael Tosch @ hp : com
Thank you it solved the problem by
> sed 's,,&\
> ,'
>
> Or at each <
>
> sed 's,<,\
> <,g'
Re: insert new line
am 07.12.2007 10:34:38 von sant527
On Dec 7, 1:53 pm, "sant...@gmail.com" wrote:
> On Dec 6, 8:42 pm, Michael Tosch
> wrote:
>
>
>
> > Stephane Chazelas wrote:
> > > On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant...@gmail.com wrote:
> > >> I have file with the following content in a single line
>
> > >> tava śiṣyeṇa dhīmatā
> > >> CLASS=t>SYNONYMS
SYNONYMS
>
> > >> I want to insert a new line at
>
> > >> How to do it using sed command.
>
> > > Assuming a Bourne-like shell:
>
> > > sed 's,,&\
> > > ,g'
>
> > If you want to have a new line at *each* .
>
> > Only at the 1st
>
> > sed 's,,&\
> > ,'
>
> > Or at each <
>
> > sed 's,<,\
> > <,g'
>
> > --
> > Michael Tosch @ hp : com
>
> Thank you it solved the problem by
>
> > sed 's,,&\
> > ,'
>
> > Or at each <
>
> > sed 's,<,\
> > <,g'
I am trying to do
bash$ sed 's:<\/*>:&\
:g' 4.htm > cool.htm
its not woking. i am expecting that it should put a line a every where
a end tag is found
Re: insert new line
am 07.12.2007 10:56:28 von Bill Marcum
On 2007-12-07, sant527@gmail.com wrote:
>
> I am trying to do
>
>
> bash$ sed 's:<\/*>:&\
>:g' 4.htm > cool.htm
>
> its not woking. i am expecting that it should put a line a every where
> a end tag is found
bash$ sed 's:<\/[^>]*>:&\
:g' 4.htm > cool.htm
Re: insert new line
am 07.12.2007 11:05:18 von Janis Papanagnou
On 7 Dez., 10:34, "sant...@gmail.com" wrote:
> On Dec 7, 1:53 pm, "sant...@gmail.com" wrote:
>
>
>
> > On Dec 6, 8:42 pm, Michael Tosch
> > wrote:
>
> > > Stephane Chazelas wrote:
> > > > On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant...@gmail.com wrote:
> > > >> I have file with the following content in a single line
>
> > > >> tava śiṣyeṇa dhīmatā
> > > >> CLASS=t>SYNONYMS
SYNONYMS
>
> > > >> I want to insert a new line at
>
> > > >> How to do it using sed command.
>
> > > > Assuming a Bourne-like shell:
>
> > > > sed 's,,&\
> > > > ,g'
>
> > > If you want to have a new line at *each* .
>
> > > Only at the 1st
>
> > > sed 's,,&\
> > > ,'
>
> > > Or at each <
>
> > > sed 's,<,\
> > > <,g'
>
> > > --
> > > Michael Tosch @ hp : com
>
> > Thank you it solved the problem by
>
> > > sed 's,,&\
> > > ,'
>
> > > Or at each <
>
> > > sed 's,<,\
> > > <,g'
>
> I am trying to do
>
> bash$ sed 's:<\/*>:&\
> :g' 4.htm > cool.htm
>
> its not woking. i am expecting that it should put a line a every where
> a end tag is found
You forgot a dot...
sed 's:<\/.*>:&\
:g' 4.htm > cool.htm
Janis
Re: insert new line
am 07.12.2007 11:21:51 von Michael Tosch
sant527@gmail.com wrote:
> On Dec 7, 1:53 pm, "sant...@gmail.com" wrote:
>> On Dec 6, 8:42 pm, Michael Tosch
>> wrote:
>>
>>
>>
>>> Stephane Chazelas wrote:
>>>> On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant...@gmail.com wrote:
>>>>> I have file with the following content in a single line
>>>>> tava śiṣyeṇa dhīmatā
>>>>> CLASS=t>SYNONYMS
SYNONYMS
>>>>> I want to insert a new line at
>>>>> How to do it using sed command.
>>>> Assuming a Bourne-like shell:
>>>> sed 's,,&\
>>>> ,g'
>>> If you want to have a new line at *each* .
>>> Only at the 1st
>>> sed 's,,&\
>>> ,'
>>> Or at each <
>>> sed 's,<,\
>>> <,g'
>>> --
>>> Michael Tosch @ hp : com
>> Thank you it solved the problem by
>>
>>> sed 's,,&\
>>> ,'
>>> Or at each <
>>> sed 's,<,\
>>> <,g'
>
> I am trying to do
>
>
> bash$ sed 's:<\/*>:&\
> :g' 4.htm > cool.htm
>
> its not woking. i am expecting that it should put a line a every where
> a end tag is found
* in regular expression means the preceding character ( the / ) can be repeated.
Further, would be too greedy so you need
sed 's:[^>]*>:&\
:g' 4.htm > cool.htm
--
Michael Tosch @ hp : com
Re: insert new line
am 07.12.2007 13:34:06 von sant527
On Dec 7, 3:21 pm, Michael Tosch
wrote:
> sant...@gmail.com wrote:
> > On Dec 7, 1:53 pm, "sant...@gmail.com" wrote:
> >> On Dec 6, 8:42 pm, Michael Tosch
> >> wrote:
>
> >>> Stephane Chazelas wrote:
> >>>> On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant...@gmail.com wrote:
> >>>>> I have file with the following content in a single line
> >>>>> tava śiṣyeṇa dhīmatā
> >>>>> CLASS=t>SYNONYMS
SYNONYMS
> >>>>> I want to insert a new line at
> >>>>> How to do it using sed command.
> >>>> Assuming a Bourne-like shell:
> >>>> sed 's,,&\
> >>>> ,g'
> >>> If you want to have a new line at *each* .
> >>> Only at the 1st
> >>> sed 's,,&\
> >>> ,'
> >>> Or at each <
> >>> sed 's,<,\
> >>> <,g'
> >>> --
> >>> Michael Tosch @ hp : com
> >> Thank you it solved the problem by
>
> >>> sed 's,,&\
> >>> ,'
> >>> Or at each <
> >>> sed 's,<,\
> >>> <,g'
>
> > I am trying to do
>
> > bash$ sed 's:<\/*>:&\
> > :g' 4.htm > cool.htm
>
> > its not woking. i am expecting that it should put a line a every where
> > a end tag is found
>
> * in regular expression means the preceding character ( the / ) can be repeated.
> Further, would be too greedy so you need
>
> sed 's:[^>]*>:&\
> :g' 4.htm > cool.htm
>
> --
> Michael Tosch @ hp : com
Sorry I couldnt get you. * means all thats inbetween to theits
extents.
Why are we using . and what is the meaning of [^>]. Can you explain
the disfferences
Re: insert new line
am 07.12.2007 13:45:16 von sant527
On Dec 7, 5:34 pm, "sant...@gmail.com" wrote:
> On Dec 7, 3:21 pm, Michael Tosch
> wrote:
>
>
>
> > sant...@gmail.com wrote:
> > > On Dec 7, 1:53 pm, "sant...@gmail.com" wrote:
> > >> On Dec 6, 8:42 pm, Michael Tosch
> > >> wrote:
>
> > >>> Stephane Chazelas wrote:
> > >>>> On Thu, 6 Dec 2007 00:23:31 -0800 (PST), sant...@gmail.com wrote:
> > >>>>> I have file with the following content in a single line
> > >>>>> tava śiṣyeṇa dhīmatā
> > >>>>> CLASS=t>SYNONYMS
SYNONYMS
> > >>>>> I want to insert a new line at
> > >>>>> How to do it using sed command.
> > >>>> Assuming a Bourne-like shell:
> > >>>> sed 's,,&\
> > >>>> ,g'
> > >>> If you want to have a new line at *each* .
> > >>> Only at the 1st
> > >>> sed 's,,&\
> > >>> ,'
> > >>> Or at each <
> > >>> sed 's,<,\
> > >>> <,g'
> > >>> --
> > >>> Michael Tosch @ hp : com
> > >> Thank you it solved the problem by
>
> > >>> sed 's,,&\
> > >>> ,'
> > >>> Or at each <
> > >>> sed 's,<,\
> > >>> <,g'
>
> > > I am trying to do
>
> > > bash$ sed 's:<\/*>:&\
> > > :g' 4.htm > cool.htm
>
> > > its not woking. i am expecting that it should put a line a every where
> > > a end tag is found
>
> > * in regular expression means the preceding character ( the / ) can be repeated.
> > Further, would be too greedy so you need
>
> > sed 's:[^>]*>:&\
> > :g' 4.htm > cool.htm
>
> > --
> > Michael Tosch @ hp : com
>
> Sorry I couldnt get you. * means all thats inbetween to theits
> extents.
>
> Why are we using . and what is the meaning of [^>]. Can you explain
> the disfferences
in the below single line
tava śiṣyeṇa dhīmatā
CLASS=t>SYNONYMSSYNONYMS
I want to insert a new line before or every occurence of tag.
How to do it using sed command.