unix command to replace anything between between two delimiter positionsGiven two directory trees, how can I find out which files differ?Merging two files by a single column in unixIs there a command to list all Unix group names?Unix command to search a line in a file and replace itChange csv file delimiter in unixUnix command to print a data between two matching patternsNeed to replace a character in unix fileUnix AWK command - multiple character as a single delimiterMatch Anything In Between Strings For Linux Grep CommandReplacing the pipe in the double quoted csv file with comma using awk command

Notepad++ - How to find multiple values on the same line in any permutation

Would this system work to purify water?

Which household object drew this pattern?

Earth rotation discrepancy

Does travel insurance for short flight delays exist?

What are some interesting features that are common cross-linguistically but don't exist in English?

Sun setting in East!

Why is less being run unnecessarily by git?

Why does The Ancient One think differently about Doctor Strange in Endgame than the film Doctor Strange?

Can a gem used as the material component for the Magic Jar spell also be used for the Imprisonment spell?

In the MCU, why does Mjölnir retain its enchantments after Ragnarok?

Is using a hyperlink to close a modal a poor design decision?

Efficiently pathfinding many flocking enemies around obstacles

Are there any music source codes for sound chips?

Confirming resignation after resignation letter ripped up

Is there a known non-euclidean geometry where two concentric circles of different radii can intersect? (as in the novel "The Universe Between")

Defense against attacks using dictionaries

Church Booleans

Is "The life is beautiful" incorrect or just very non-idiomatic?

What brought these couples together?

Potential new partner angry about first collaboration - how to answer email to close up this encounter in a graceful manner

Can a PC's alignment be forcibly changed?

What does どうかと思う mean?

LeetCode: Pascal's Triangle C#



unix command to replace anything between between two delimiter positions


Given two directory trees, how can I find out which files differ?Merging two files by a single column in unixIs there a command to list all Unix group names?Unix command to search a line in a file and replace itChange csv file delimiter in unixUnix command to print a data between two matching patternsNeed to replace a character in unix fileUnix AWK command - multiple character as a single delimiterMatch Anything In Between Strings For Linux Grep CommandReplacing the pipe in the double quoted csv file with comma using awk command






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-1















Please help me with a unix command to replace anything between two delimiter positions.
For ex: I have multiple files with below header data and I want replace the data between * delimiters at 9th and 10th position




ISA*00* *00* *ZZ*80881 *ZZ*TNC0022 *190115*1237*^*00501*000320089*0*P*|~


My output should like this:




ISA*00* *00* *ZZ*80881 *ZZ*TNC0022 *190327*1237*^*00501*000320089*0*P*|~









share|improve this question


























  • You should provide some simpler sample input/output that you will elaborate for this very particular case. This way, it will be more accurate for others users when searching the same response and you will be able to transpose the logic to your needs.

    – Gilles Quenot
    Mar 27 at 17:01


















-1















Please help me with a unix command to replace anything between two delimiter positions.
For ex: I have multiple files with below header data and I want replace the data between * delimiters at 9th and 10th position




ISA*00* *00* *ZZ*80881 *ZZ*TNC0022 *190115*1237*^*00501*000320089*0*P*|~


My output should like this:




ISA*00* *00* *ZZ*80881 *ZZ*TNC0022 *190327*1237*^*00501*000320089*0*P*|~









share|improve this question


























  • You should provide some simpler sample input/output that you will elaborate for this very particular case. This way, it will be more accurate for others users when searching the same response and you will be able to transpose the logic to your needs.

    – Gilles Quenot
    Mar 27 at 17:01














-1












-1








-1








Please help me with a unix command to replace anything between two delimiter positions.
For ex: I have multiple files with below header data and I want replace the data between * delimiters at 9th and 10th position




ISA*00* *00* *ZZ*80881 *ZZ*TNC0022 *190115*1237*^*00501*000320089*0*P*|~


My output should like this:




ISA*00* *00* *ZZ*80881 *ZZ*TNC0022 *190327*1237*^*00501*000320089*0*P*|~









share|improve this question
















Please help me with a unix command to replace anything between two delimiter positions.
For ex: I have multiple files with below header data and I want replace the data between * delimiters at 9th and 10th position




ISA*00* *00* *ZZ*80881 *ZZ*TNC0022 *190115*1237*^*00501*000320089*0*P*|~


My output should like this:




ISA*00* *00* *ZZ*80881 *ZZ*TNC0022 *190327*1237*^*00501*000320089*0*P*|~






linux






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 16:43









ceving

11k4 gold badges62 silver badges108 bronze badges




11k4 gold badges62 silver badges108 bronze badges










asked Mar 27 at 16:39









kiran kiran

1




1















  • You should provide some simpler sample input/output that you will elaborate for this very particular case. This way, it will be more accurate for others users when searching the same response and you will be able to transpose the logic to your needs.

    – Gilles Quenot
    Mar 27 at 17:01


















  • You should provide some simpler sample input/output that you will elaborate for this very particular case. This way, it will be more accurate for others users when searching the same response and you will be able to transpose the logic to your needs.

    – Gilles Quenot
    Mar 27 at 17:01

















You should provide some simpler sample input/output that you will elaborate for this very particular case. This way, it will be more accurate for others users when searching the same response and you will be able to transpose the logic to your needs.

– Gilles Quenot
Mar 27 at 17:01






You should provide some simpler sample input/output that you will elaborate for this very particular case. This way, it will be more accurate for others users when searching the same response and you will be able to transpose the logic to your needs.

– Gilles Quenot
Mar 27 at 17:01













1 Answer
1






active

oldest

votes


















-1















Try this:



perl -pe 's/^((?:[^*]**)9)([^*]+)(.*)/$1190327$3/'


The regexp searches for 9 occurences 9 of anything but not being a star [^*] followed by a star * and stores all in the first capture group. The second capture is at least one character not being a star [^*]+. And the third capture is the rest of the line.



A matching line gets replaced by the first part $1, your new value 190327 and the third part $3.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55382373%2funix-command-to-replace-anything-between-between-two-delimiter-positions%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    -1















    Try this:



    perl -pe 's/^((?:[^*]**)9)([^*]+)(.*)/$1190327$3/'


    The regexp searches for 9 occurences 9 of anything but not being a star [^*] followed by a star * and stores all in the first capture group. The second capture is at least one character not being a star [^*]+. And the third capture is the rest of the line.



    A matching line gets replaced by the first part $1, your new value 190327 and the third part $3.






    share|improve this answer





























      -1















      Try this:



      perl -pe 's/^((?:[^*]**)9)([^*]+)(.*)/$1190327$3/'


      The regexp searches for 9 occurences 9 of anything but not being a star [^*] followed by a star * and stores all in the first capture group. The second capture is at least one character not being a star [^*]+. And the third capture is the rest of the line.



      A matching line gets replaced by the first part $1, your new value 190327 and the third part $3.






      share|improve this answer



























        -1














        -1










        -1









        Try this:



        perl -pe 's/^((?:[^*]**)9)([^*]+)(.*)/$1190327$3/'


        The regexp searches for 9 occurences 9 of anything but not being a star [^*] followed by a star * and stores all in the first capture group. The second capture is at least one character not being a star [^*]+. And the third capture is the rest of the line.



        A matching line gets replaced by the first part $1, your new value 190327 and the third part $3.






        share|improve this answer













        Try this:



        perl -pe 's/^((?:[^*]**)9)([^*]+)(.*)/$1190327$3/'


        The regexp searches for 9 occurences 9 of anything but not being a star [^*] followed by a star * and stores all in the first capture group. The second capture is at least one character not being a star [^*]+. And the third capture is the rest of the line.



        A matching line gets replaced by the first part $1, your new value 190327 and the third part $3.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 27 at 17:01









        cevingceving

        11k4 gold badges62 silver badges108 bronze badges




        11k4 gold badges62 silver badges108 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55382373%2funix-command-to-replace-anything-between-between-two-delimiter-positions%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해