小编Pen*_*nny的帖子

使用批处理文件从多个csv文件中删除特殊字符

我想使用批处理文件删除我的csv文件中的所有特殊字符.我的csv文件只有一列只能在谷歌中输入关键字

例如1.Ecommerce 2.dentist Melbourne cbd?3.墨尔本墨尔本最好的牙医!

有时我也可以有Aracbic /中文字符等等.

这里当我将这些文件添加到GoogleAdwords-Keyword Planner时,它会向我显示错误,忽略错误我错了没有.关键字的命中和避免错误我需要从我的csv文件中删除所有特殊字符.

我有数百个csv文件,并希望将更新的(没有特殊字符)文件保存到现有文件.

我试过了

@echo off
set source_folder=C:\Users\Username\Documents\iMacros\Datasources\a
set target_folder=C:\Users\Username\Documents\iMacros\Datasources\keyfords-csv-file
if not exist %target_folder% mkdir %target_folder%

for /f %%A in ('dir /b %source_folder%\*.csv') do (
    for /f "skip=1 tokens=1,2* delims=," %%B in (%source_folder%\%%A) do (
    echo %%B>>%target_folder%\%%A
    )
)

timeout /t 20
Run Code Online (Sandbox Code Playgroud)

但最终删除了csv文件中的所有记录.

无论如何我也可以

1.仅接受来自AZ,az和0-9的标准字符.

2.Or删除我可以在该字符串中放入特殊字符的所有字符串.像string1 ="?%!@#$ ^&*<>"

3.无论如何,我可以在csv文件中提及只接受标准英文字符有没有办法用批处理文件或任何框架来实现这一点?

谢谢

csv excel batch-file

9
推荐指数
1
解决办法
1479
查看次数

使用谷歌图像图表设置轴的范围

我正在尝试使用更改图表的范围chxr.

我的代码是

<img class="image_graph" width="170px" height="180px" src="https://chart.googleapis.com/chart?chs=170x180&cht=ls&chco=0000FF&chd=t:<?php echo $test ?>&chxr=x,y,r&chxr=0,0,30|1,0,10|2,1000,0"/>
Run Code Online (Sandbox Code Playgroud)

默认情况下,它取y轴0 to 100.

我该如何纠正这个并允许改变我的范围?

我参考了图表.它说它被弃用了.我应该使用其他谷歌图书馆吗?

charts linechart google-api

5
推荐指数
1
解决办法
678
查看次数

PHP函数在"&"后不显示字符串

我正在使用CI和Windows 7.在我的视图文件中,我在ajax中调用一个函数,它位于控制器中.在我的ajax中,我传递一个字符串Pack & Send,但是当我在控制器函数中回显相同的字符串时,它只是回显Pack.

我的ajax电话看起来像

<script>
      $(document).ready(function(){
        $("select#items").change(function(){
            var country_id =  $("select#items option:selected").attr('value'); 
            $("#state").html( "" );
            $("#city").html( "" );
            if (country_id.length > 0 ) { 
             $.ajax({
                    type: "POST",
                    url: "<?php echo site_url('ga_api/sample/ajax_second_dropdown');?>",
                    data: "country_id="+country_id,
                    cache: false,
                    beforeSend: function () { 
                        $('#state').html('<img src="<?php echo IMAGE_PATH;?>loader.gif" alt="" width="24" height="24">');
                    },
                    success: function(html) {    
                        $("#state").html( html );
                    }
                });
            } 
          alert(country_id);
        });
      });
    </script>
Run Code Online (Sandbox Code Playgroud)

在警报我得到整个字符串即Pack & Send.

现在我的php功能在控制器中

function ajax_second_dropdown()
{
    echo $_POST["country_id"]; 
}
Run Code Online (Sandbox Code Playgroud)

这里只是回声 Pack

我想可能是因为特殊的性格.但我想这不是场景我试图改变 …

javascript php ajax

5
推荐指数
1
解决办法
91
查看次数

批处理文件错误 - 系统找不到文件 abc.csv

这个 .bat 文件分割了我的 csv 大文件。

当我在本地运行时,代码工作得很好。我在本地的代码如下所示

@echo off
setlocal ENABLEDELAYEDEXPANSION
set target_folder=C:\Users\username\Desktop\splitted-files
if not exist %target_folder% mkdir %target_folder%
for /f %%a IN ('dir /b "C:\Users\username\Desktop\split-large-csv-files\*.csv"') do (



    REM Edit this value to change the name of the file that needs splitting. Include the extension.
    SET filename=%%a
    REM Edit this value to change the number of lines per file.
    SET LPF=3000
    REM Edit this value to change the name of each short file. It will be followed by a number indicating …
Run Code Online (Sandbox Code Playgroud)

cmd batch-file

2
推荐指数
1
解决办法
3158
查看次数

标签 统计

batch-file ×2

ajax ×1

charts ×1

cmd ×1

csv ×1

excel ×1

google-api ×1

javascript ×1

linechart ×1

php ×1