Cut (change in question)
am 28.11.2007 07:23:41 von sant527
Sorry I have posted this before but I have a slight change in the
question.
I have an html file.The entire script is in one line only. The
following is the script.
Chapter
1: ................................................. |
tbody>
Rama ......................
where .............. is a variable text
In the above script I want to delete the text
Chapter
1: ................................................. |
tbody>
where ........ represents variable content.
I have 100 files with names 1.htm to 100.htm
How can i do this using unix commands rather than selecting the text
and deleting.
Thanks
Santhosh
Re: Cut (change in question)
am 29.11.2007 04:49:38 von Ed Morton
On 11/28/2007 12:23 AM, sant527@gmail.com wrote:
> Sorry I have posted this before but I have a slight change in the
> question.
>
> I have an html file.The entire script is in one line only. The
> following is the script.
>
>
Chapter
> 1: ................................................. |
> tbody>
> Rama ......................
>
> where .............. is a variable text
>
> In the above script I want to delete the text
>
>
> Chapter
> 1: ................................................. |
> tbody>
>
>
> where ........ represents variable content.
>
>
> I have 100 files with names 1.htm to 100.htm
>
>
> How can i do this using unix commands rather than selecting the text
> and deleting.
>
Depending on whether not "" can occur multiple times on a
line, this may be all you need:
for file in *.htm
do
sed 's:::' "$file" > tmp &&
mv tmp "$file"
done
Regards,
Ed.
Re: Cut (change in question)
am 30.11.2007 05:44:47 von sant527
On Nov 29, 8:49 am, Ed Morton wrote:
> On 11/28/2007 12:23 AM, sant...@gmail.com wrote:
>
>
>
> > Sorry I have posted this before but I have a slight change in the
> > question.
>
> > I have an html file.The entire script is in one line only. The
> > following is the script.
>
> > Chapter
> > 1: ................................................. |
> > tbody>
> > Rama ......................
>
> > where .............. is a variable text
>
> > In the above script I want to delete the text
>
> > Chapter
> > 1: ................................................. |
> > tbody>
>
> > where ........ represents variable content.
>
> > I have 100 files with names 1.htm to 100.htm
>
> > How can i do this using unix commands rather than selecting the text
> > and deleting.
>
> Depending on whether not "" can occur multiple times on a
> line, this may be all you need:
>
> for file in *.htm
> do
> sed 's:::' "$file" > tmp &&
> mv tmp "$file"
> done
>
> Regards,
>
> Ed.
"" can occur multiple times on a line then what
can be done
Re: Cut (change in question)
am 30.11.2007 05:57:25 von Ed Morton
On 11/29/2007 10:44 PM, sant527@gmail.com wrote:
> On Nov 29, 8:49 am, Ed Morton wrote:
>
>>On 11/28/2007 12:23 AM, sant...@gmail.com wrote:
>>
>>
>>
>>
>>>Sorry I have posted this before but I have a slight change in the
>>>question.
>>
>>>I have an html file.The entire script is in one line only. The
>>>following is the script.
>>
>>>Chapter
>>>1: ................................................. |
>>>tbody>
>>>Rama ......................
>>
>>>where .............. is a variable text
>>
>>>In the above script I want to delete the text
>>
>>>Chapter
>>>1: ................................................. |
>>>tbody>
>>
>>>where ........ represents variable content.
>>
>>>I have 100 files with names 1.htm to 100.htm
>>
>>>How can i do this using unix commands rather than selecting the text
>>>and deleting.
>>
>>Depending on whether not "" can occur multiple times on a
>>line, this may be all you need:
>>
>>for file in *.htm
>>do
>> sed 's:::' "$file" > tmp &&
>> mv tmp "$file"
>>done
>>
>>Regards,
>>
>> Ed.
>
>
>
> "" can occur multiple times on a line then what
> can be done
Use all of the unique text you mentioned and replace the chain of periods with ".*":
sed 's:::'
If the text on either side of the ".*" can appear elsewhere on the same line,
then it's a harder problem that needs a different approach.
Ed.
Re: Cut (change in question)
am 30.11.2007 06:46:46 von sant527
On Nov 30, 9:57 am, Ed Morton wrote:
> On 11/29/2007 10:44 PM, sant...@gmail.com wrote:
>
>
>
> > On Nov 29, 8:49 am, Ed Morton wrote:
>
> >>On 11/28/2007 12:23 AM, sant...@gmail.com wrote:
>
> >>>Sorry I have posted this before but I have a slight change in the
> >>>question.
>
> >>>I have an html file.The entire script is in one line only. The
> >>>following is the script.
>
> >>>Chapter
> >>>1: ................................................. |
> >>>tbody>
> >>>Rama ......................
>
> >>>where .............. is a variable text
>
> >>>In the above script I want to delete the text
>
> >>>Chapter
> >>>1: ................................................. |
> >>>tbody>
>
> >>>where ........ represents variable content.
>
> >>>I have 100 files with names 1.htm to 100.htm
>
> >>>How can i do this using unix commands rather than selecting the text
> >>>and deleting.
>
> >>Depending on whether not "" can occur multiple times on a
> >>line, this may be all you need:
>
> >>for file in *.htm
> >>do
> >> sed 's:::' "$file" > tmp &&
> >> mv tmp "$file"
> >>done
>
> >>Regards,
>
> >> Ed.
>
> > "" can occur multiple times on a line then what
> > can be done
>
> Use all of the unique text you mentioned and replace the chain of periods with ".*":
>
> sed 's:::'
>
> If the text on either side of the ".*" can appear elsewhere on the same line,
> then it's a harder problem that needs a different approach.
>
> Ed.
Thank you.