我有1个html文件,其中包含2个单独的html文件。我想编写一个查找标记的批处理文件,并将原始html拆分为2个html文件。
这就是我试过的
@echo off & setlocal enabledelayedexpansion
SETLOCAL DisableDelayedExpansion
set c=0
for /f "tokens=*" %%a in (split.html) do (
if "%%a" equ "</html>" (
set /a c+=1
>f!c!.html echo.
) else (
>> f!c!.html echo( %%a)
)
)
在html文件中,有!
字符,但在输出文件中,所有字符都丢失了。如何在输出文件中保留!
?
由于
更新26-07-2015 我从这里得到了答案。感谢大家的帮助。 Split text file into 2 files by separator
@echo off
set /p file=FILE TO PROCESS :
del /q /f out.file*
setlocal enableDelayedExpansion
set out_file_counter=1
for /f "usebackq delims=" %%L in ("%file%") do (
set line=%%L
if "!line:~0,5!" equ "=====" (
set /a out_file_counter=out_file_counter+1
) else (
echo !line!>>out.file.!out_file_counter!
)
)
endlocal
答案 0 :(得分:0)
!
个变量。要在html中正确输出@echo off & setlocal enabledelayedexpansion
set c=0
for /f "tokens=*" %%a in (split.html) do (
if "%%a" equ "</html>" (
set /a c+=1
>f!c!.html echo.
) else (
>> f!c!.html (
ENDLOCAL
echo %%a
SETLOCAL EnableDelayedExpansion
)
)
)
个字符,请禁用循环内的扩展:
ParentId, CategoryId, Title
null, 1, Home
null, 2, Business
null, 3, Hobbies
1, 4, Gardening
1, 5, Kitchen
1, 6, ...
2, 7, Development
2, 8, Marketing
2, 9, ...
3, 10, Soccer
3, 11, Reading
3, 12, ...
答案 1 :(得分:0)
public function adding()
{
$id_lap=$this->input->post('id_lap');
$num_items=$this->input->post('num_items');
$price=$this->input->post('price');
if($id_lap !='')
{
$this->session->set_userdata('num_items',$num_items);
$this->session->set_userdata('price_new',$price);
$response=array(
'status'=>1,
'num_items'=>$num_items,
'price_new'=>$price
);
} else {
$response=array(
'status'=>0
);
}
echo json_encode($response);
}
答案 2 :(得分:0)
我从这里得到了答案。感谢大家的帮助。 Split text file into 2 files by separator
@echo off
set /p file=FILE TO PROCESS :
del /q /f out.file*
setlocal enableDelayedExpansion
set out_file_counter=1
for /f "usebackq delims=" %%L in ("%file%") do (
set line=%%L
if "!line:~0,5!" equ "=====" (
set /a out_file_counter=out_file_counter+1
) else (
echo !line!>>out.file.!out_file_counter!
)
)
endlocal