正确的格式是' sed'命令?

时间:2017-02-10 15:37:56

标签: bash awk sed

我正在尝试重命名某些文件,并需要帮助格式化正确的' sed'命令;

我有一个看起来像这样的电影剧集文件;

SG1_s10e8"Memento Mori"
SG1_s10e9"Company of Thieves"
SG1_s10e10"The Quest"
SG1_s10e11"The Quest Part 2"

我需要用一个' 0'来填充#像这样;

SG1_s10e08"Memento Mori"
SG1_s10e09"Company of Thieves"
SG1_s10e10"The Quest"
SG1_s10e11"The Quest Part 2"

我确定sed是正确的工具,我只是不太熟悉命令语法。

我将不胜感激。

2 个答案:

答案 0 :(得分:3)

sed 's/e\([0-9]"[^"]*"\)/e0\1/' file

答案 1 :(得分:1)

你可以试试这个:

<script >
    function myModalFunction() {
        $("#AddTask").modal();
    } </script>

// method to trigger an jsFunction
public void dispararJSfunction(string script)
{
    try
    {
        Page page = HttpContext.Current.CurrentHandler as Page;
        ScriptManager.RegisterStartupScript(Page, this.Page.GetType(), "its working", script, true);
    }
    catch (Exception ex) { Master.MostrarMsn(ex.Message, 0); }
}

protected void imgAppointment_Click(object sender, EventArgs e)
{

    // script = the js modal function
    dispararJSfunction("myModalFunction()");

    CommandEventArgs commandArgs = new CommandEventArgs("Command Name Here", "Your Command Argument Here");
    //You can pass any row
    //You can also skip the row parameter and get the row from Command Argument
    GridViewCommandEventArgs eventArgs = new GridViewCommandEventArgs(GridView1.Rows[0], GridView1, commandArgs);
    GridView1_RowCommand(GridView1, eventArgs);
}